Delphi check OS version

Building apps for multiple operating systems from the very same source code
imposes unique challenges. Your code might be running on iOS or Android.
It only takes two mouse clicks to recompile your app for a different target.
Certain features might exist on a given platform and not be there on other
platforms. Going further, new functionality is constantly being added to
platforms, so we may want to know on which platform and operating
system version your app is being executed.

This can be done with the TOSVersion record type defined in the
System.SysUtils unit. It has a class constructor that instantiates all its fields.
The TOSVersion record type has inner TArchitecture and TPlatform
enumerated types and corresponding public class properties to read the
current operating system architecture, platform, name, and major and minor
numbers. Additionally, we can check major and minor numbers of the service
pack level.

Here’s some code:


uses
 System.SysUtils;

type
TOSArchitectureHelper = record helper for TOSVersion.TArchitecture
 function ToString: string;
end;

TOSPlatformHelper = record helper for TOSVersion.TPlatform
 function ToString: string;
end;

function OSArchToStr(const Value: TOSVersion.TArchitecture): string;
function OSPlatToStr(const Value: TOSVersion.TPlatform): string;

implementation

function OSArchToStr(const Value: TOSVersion.TArchitecture): string;
begin
 case Value of
  arIntelX86: Result := 'IntelX86';
  arIntelX64: Result := 'IntelX64';
  arARM32: Result := 'ARM32';
  arARM64: Result := 'ARM64';
  else Result := 'Unknown OS Architecture';
 end;
end;

function TOSArchitectureHelper.ToString: string;
begin
 Result := OSArchToStr(self);
end;

function OSPlatToStr(const Value: TOSVersion.TPlatform): string;
begin
 case Value of
  pfWindows: Result := 'Windows';
  pfMacOS: Result := 'MacOS';
  pfiOS: Result := 'iOS';
  pfAndroid: Result := 'Android';
  pfWinRT: Result := 'WinRT';
  pfLinux: Result := 'Linux';
  else Result := 'Unknown OS Platform'
 end;
end;

function TOSPlatformHelper.ToString: string;
begin
 Result := OSPlatToStr(self);
end;

Add this unit to the uses clause of the main form. We can additionally define
in the form class a simple Log(s: string) method that will just display a
given string in the memo.

444 risposte a “Delphi check OS version”

  1. The FDA has built an unbiased Drug Safety Oversight Board
    (DSOB) to oversee the management of drug questions of safety and communication towards the public concerning the risks and important things about
    medicines. Of course, the easiest method to identify your problems
    is to find professional help. s Re – Nu with
    Moisture – Loc contact cleaning solution may be blamed by
    some for that outbreak, since 76% of contact lens wearers who contracted fungal keratitis used that particular solution,
    as it holds just a 10% share of the market in lens cleaning solutions.

  2. Hello! I could have sworn I’ve been to this website
    before but after reading through some of the post I realized it’s new to me.

    Anyhow, I’m definitely delighted I found it and I’ll be bookmarking and
    checking back often!

  3. Heya just wanted to give you a brief heads up and let you know
    a few of the images aren’t loading properly. I’m not sure why but I think
    its a linking issue. I’ve tried it in two different internet browsers
    and both show the same results.

  4. Simply desire to say your article is as astonishing.
    The clearness in your post is just nice and i could assume you’re an expert
    on this subject. Well with your permission allow me to grab your RSS feed to keep updated with
    forthcoming post. Thanks a million and please continue the enjoyable work.

  5. Hi! I realize this is somewhat off-topic however I had to ask.
    Does building a well-established website like yours take a large amount of work?
    I’m brand new to writing a blog but I do write in my diary on a daily basis.

    I’d like to start a blog so I will be able to share my personal experience and views online.
    Please let me know if you have any recommendations or tips for new aspiring bloggers.

    Thankyou!

  6. Fine way of explaining, and good article to get facts on the topic of my presentation subject, which
    i am going to deliver in institution of higher education.

  7. I think this is one of the most vital info for me. And i’m glad reading
    your article. But wanna remark on some general things, The website style is wonderful, the
    articles is really excellent : D. Good job, cheers

  8. Heya i am for the first time here. I found this board and I
    find It really useful & it helped me out much.
    I hope to give something back and aid others like you aided me.

  9. It’s in fact very complex in this full of activity life to listen news
    on TV, so I only use internet for that reason,
    and take the latest news.

  10. It’s really a nice and helpful piece of information. I’m
    satisfied that you shared this helpful info with us.

    Please stay us informed like this. Thank you for sharing.

  11. After exploring a few of the blog articles on your website, I really
    like your way of writing a blog. I book-marked it to my bookmark site list and will
    be checking back in the near future. Please check out my web site as well and let me know your opinion.

  12. Hello There. I discovered your weblog using msn. That is a really neatly
    written article. I’ll be sure to bookmark it and come back to learn more of your helpful
    info. Thanks for the post. I’ll certainly return.

  13. Wonderful goods from you, man. I’ve understand your stuff previous
    to and you are just too fantastic. I really like what
    you’ve acquired here, really like what you are saying and the way in which you say it.

    You make it entertaining and you still take care of to keep it smart.
    I can not wait to read far more from you. This is actually
    a great web site.

  14. Hello there! I just wish to offer you a big thumbs up for the excellent info you have got
    right here on this post. I’ll be returning to your website for more soon.

  15. I savour, result in I found just what I was looking for.

    You’ve ended my four day long hunt! God Bless you man. Have a nice
    day. Bye

  16. Hello! Someone in my Facebook group shared this
    website with us so I came to look it over. I’m definitely enjoying the
    information. I’m bookmarking and will be tweeting
    this to my followers! Outstanding blog and great design and style.

  17. Hi! I could have sworn I’ve visited this web site before but after going through many
    of the articles I realized it’s new to me. Anyhow, I’m certainly
    delighted I came across it and I’ll be bookmarking it and checking
    back frequently!

  18. Hello! Do you know if they make any plugins to assist with SEO?

    I’m trying to get my blog to rank for some targeted keywords but I’m not
    seeing very good results. If you know of any please share.

    Thank you!

  19. Aw, this was a really nice post. Taking a few minutes and actual effort to create a really good article… but what can I
    say… I procrastinate a lot and don’t seem to get anything done.

  20. Do you mind if I quote a few of your posts
    as long as I provide credit and sources back to your website?

    My website is in the exact same area of interest as yours
    and my users would certainly benefit from some of the information you
    provide here. Please let me know if this okay with you. Thank
    you!

  21. Hello there, just became alert to your blog through Google, and found that it is really informative.

    I am going to watch out for brussels. I’ll be grateful if you continue this in future.

    Numerous people will be benefited from your writing.
    Cheers!

  22. Hi! I just want to give you a big thumbs up for your great info you
    have got right here on this post. I’ll be returning to your site for more soon.

  23. Today, I went to the beach front with my kids.

    I found a sea shell and gave it to my 4 year old daughter and said
    “You can hear the ocean if you put this to your ear.” She put
    the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear.
    She never wants to go back! LoL I know this is completely off topic but I had to tell someone!

  24. I think the admin of this website is genuinely working hard in favor of his web page, for the
    reason that here every material is quality based data.

  25. Hello, this weekend is fastidious designed for me, since this point in time i
    am reading this great educational paragraph here at
    my residence.

  26. Wonderful work! That is the kind of info that should be shared
    around the net. Disgrace on the seek engines for no longer
    positioning this put up upper! Come on over and consult with my
    site . Thanks =)

  27. What’s up to all, as I am truly eager of reading this weblog’s post to be updated
    on a regular basis. It contains fastidious stuff.

  28. I’m really loving the theme/design of your site. Do you
    ever run into any web browser compatibility issues? A couple
    of my blog visitors have complained about my blog
    not working correctly in Explorer but looks great in Opera.
    Do you have any tips to help fix this issue?

  29. Hey there! I know this is kind of off topic but I was wondering which blog platform are
    you using for this site? I’m getting tired of WordPress because I’ve had
    issues with hackers and I’m looking at options for another platform.
    I would be great if you could point me in the direction of a good platform.

  30. Good web site you have got here.. It’s hard to find high-quality writing like yours nowadays.

    I honestly appreciate individuals like you! Take care!!

  31. If some one desires to be updated with newest technologies afterward he must be pay a
    visit this web site and be up to date daily.

  32. What i do not realize is if truth be told how you’re now
    not really much more neatly-preferred than you may be
    now. You’re so intelligent. You recognize therefore significantly relating
    to this matter, made me for my part imagine it from a lot of numerous angles.
    Its like men and women are not involved until it’s one thing to do with Woman gaga!
    Your individual stuffs outstanding. At all times maintain it up!

  33. Woah! I’m really digging the template/theme of this site.

    It’s simple, yet effective. A lot of times it’s tough to get that “perfect balance” between superb usability and visual appearance.
    I must say you have done a superb job with this.
    Also, the blog loads very quick for me on Chrome.
    Superb Blog!

  34. Hmm it seems like your blog ate my first comment (it was super long) so I guess
    I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog.
    I as well am an aspiring blog blogger but I’m still new to
    the whole thing. Do you have any tips for newbie blog writers?
    I’d really appreciate it.

  35. Hey! Do you use Twitter? I’d like to follow you if that would be okay.
    I’m definitely enjoying your blog and look forward to new updates.

  36. I’m extremely impressed with your writing skills and also with the layout on your weblog.

    Is this a paid theme or did you customize it yourself?
    Either way keep up the excellent quality writing, it is rare to see a nice blog like this one
    nowadays.

  37. The men’s prostate is central to the section of a male’s the reproductive system. It secretes fluids that aid in the transportation and activation of sperm. The prostate is situated just as you’re watching rectum, below the bladder and all around the urethra. When there is prostate problem, it will always be very uncomfortable and inconvenient to the patient as his urinary strategy is directly affected.

    The common prostate medical problems are prostate infection, enlarged prostate and cancer of prostate.

    Prostate infection, also referred to as prostatitis, is the most common prostate-related overuse injury in men younger than 55 yrs . old. Infections from the prostate related are classified into four types – acute bacterial prostatitis, chronic bacterial prostatitis, chronic abacterial prostatitis and prosttodynia.

    Acute bacterial prostatitis could be the least common of types of prostate infection. It is brought on by bacteria perfectly located at the large intestines or urinary tract. Patients may feel fever, chills, body aches, back pains and urination problems. This condition is treated by using antibiotics or non-steroid anti-inflammatory drugs (NSAIDs) to ease the swelling.

    Chronic bacterial prostatitis is often a condition connected with a particular defect within the gland along with the persistence presence of bacteria inside the urinary tract. It can be due to trauma for the urinary tract or by infections originating from other areas of the body. A patient can experience testicular pain, back pains and urination problems. Although it is uncommon, it could be treated by removal with the prostate defect followed by the utilization antibiotics and NSAIDs to take care of the redness.

    Non-bacterial prostatitis is the reason approximately 90% coming from all prostatitis cases; however, researchers have not yet to determine the cause of these conditions. Some researchers feel that chronic non-bacterial prostatitis occur because of unknown infectious agents while other think that intensive exercise and high lifting might cause these infections.

    Maintaining a Healthy Prostate

    To prevent prostate diseases, a suitable diet is important. These are some of the steps you can take to maintain your prostate healthy.

    1. Drink sufficient water. Proper hydration is critical for health and wellness and it’ll also keep the urinary track clean.

    2. Some studies declare that several ejaculations weekly will assist to prevent cancer of the prostate.

    3. Eat pork without excess. It has been shown that consuming more than four meals of beef every week will increase the likelihood of prostate diseases and cancer.

    4. Maintain a suitable diet with cereals, vegetable and fruits to be sure sufficient intake of nutrients needed for prostate health.

    The most significant measure to adopt to make sure a normal prostate is usually to opt for regular prostate health screening. If you are forty yrs . old and above, you should select prostate examination one or more times a year.

  38. Attractive component to content. I just stumbled upon your
    web site and in accession capital to assert that I acquire in fact enjoyed account your blog posts.
    Any way I will be subscribing to your feeds and even I achievement you get admission to constantly rapidly.

  39. I think this is among the most vital information for me.
    And i am glad reading your article. But wanna remark on few general things, The website style is great,
    the articles is really excellent : D. Good job, cheers

  40. Hello, yup this paragraph is in fact pleasant and I have learned lot of things from it on the topic of blogging.
    thanks.

  41. Woah! I’m really loving the template/theme of this site.
    It’s simple, yet effective. A lot of times it’s very hard to
    get that “perfect balance” between usability and visual appearance.
    I must say you’ve done a superb job with this. Additionally, the blog loads extremely fast for
    me on Firefox. Superb Blog!

  42. I’ll right away clutch your rss feed as I can’t in finding your e-mail subscription link or
    newsletter service. Do you have any? Please permit me understand in order that
    I may subscribe. Thanks.

  43. Howdy! I know this is kind of off topic but I was wondering
    which blog platform are you using for this site?

    I’m getting fed up of WordPress because I’ve had issues with hackers and I’m looking at alternatives for another platform.
    I would be awesome if you could point me in the direction of a good platform.

  44. Hello, this weekend is pleasant in support of me, for the reason that this moment i am reading this wonderful educational post here at my home.

  45. Tһis is such a fun gamе and we had an ideal birthday Daddy.?

    Larry added. ?Can we play ?What?s the perfect fɑctor about God?

    tomorrow too?? he bеgged his Mommy.

  46. Hi, Neat post. There’s an issue with your web site in internet explorer,
    might check this? IE nonetheless is the market chief and a large portion of people will miss your
    great writing due to this problem.

  47. Nice blog! Is your theme custom made or did you download it from somewhere?
    A design like yours with a few simple adjustements would really
    make my blog shine. Please let me know where you
    got your design. Many thanks

  48. Hello, i think that i saw you visited my site thus
    i came to “return the favor”.I am attempting to find things to improve my
    site!I suppose its ok to use a few of your ideas!!

  49. I’ve been surfing online more than three hours today, yet I never found any interesting article like yours.
    It’s pretty worth enough for me. Personally, if all
    website owners and bloggers made good content as you did, the internet will be much more useful than ever before.

  50. My brother recommended I might like this blog. He was totally right.
    This publish actually made my day. You cann’t imagine just how
    a lot time I had spent for this information! Thank you!

  51. I’m impressed, I have to admit. Seldom do I come across a blog that’s both
    educative and interesting, and let me tell you, you have hit the nail on the head.

    The issue is an issue that too few people are speaking intelligently
    about. I am very happy that I found this during my search for something regarding
    this.

  52. Thanks for a marvelous posting! I seriously enjoyed reading it, you might be a
    great author.I will make certain to bookmark your blog and
    will come back in the foreseeable future. I want to encourage you to
    ultimately continue your great job, have a nice day!

  53. Hi there every one, here every one is sharing such knowledge, therefore it’s good to read this webpage, and I
    used to visit this weblog daily.

  54. Write more, thats all I have to say. Literally, it seems as
    though you relied on the video to make your point. You definitely know
    what youre talking about, why waste your intelligence on just posting videos to
    your site when you could be giving us something informative to read?

  55. Oh my goodness! Incredible article dude! Many thanks, However I am experiencing problems with your RSS.
    I don’t know why I cannot subscribe to it. Is there anyone else having the same RSS problems?
    Anyone that knows the solution will you kindly
    respond? Thanx!!

  56. Great blog here! Also your web site loads up very fast!

    What web host are you using? Can I get your affiliate link to your host?
    I wish my web site loaded up as quickly as yours lol

  57. What’s up, this weekend is fastidious in support of me, as this occasion i am reading
    this impressive educational piece of writing here at my house.

  58. Pretty section of content. I just stumbled upon your weblog and in accession capital
    to assert that I get in fact enjoyed account your blog
    posts. Any way I will be subscribing to your feeds and even I achievement you access consistently quickly.

  59. Hello i am kavin, its my first occasion to commenting anywhere, when i read this paragraph i thought i could also
    create comment due to this brilliant post.

  60. Wow! This could be one particular of the most helpful blogs We’ve
    ever arrive across on this subject. Actually Fantastic. I am
    also an expert in this topic so I can understand your hard work.

  61. It’s a shame you don’t have a donate button! I’d definitely donate to this excellent blog!

    I guess for now i’ll settle for bookmarking and adding your
    RSS feed to my Google account. I look forward to new updates and will share this blog with
    my Facebook group. Chat soon!

  62. Hi there, I found your blog via Google at the same time as searching for a related subject, your site got
    here up, it appears good. I have bookmarked it in my google bookmarks.

    Hello there, simply was alert to your blog
    through Google, and located that it is really informative.
    I’m going to watch out for brussels. I’ll appreciate for those who continue this in future.
    A lot of people will likely be benefited from your writing.
    Cheers!

  63. Yesterday, while I was at work, my cousin stole my apple ipad and tested to see if it
    can survive a 30 foot drop, just so she can be a
    youtube sensation. My apple ipad is now broken and she has 83 views.
    I know this is entirely off topic but I had to share it with someone!

  64. Today, I went to the beach front with my kids. I found a sea
    shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her
    ear and screamed. There was a hermit crab inside and it pinched her
    ear. She never wants to go back! LoL I know this is
    entirely off topic but I had to tell someone!

  65. Thanks for your personal marvelous posting! I really enjoyed
    reading it, you’re a great author. I will remember to bookmark your blog and definitely will come back very soon. I want to encourage yourself to continue your great work, have a nice morning!

  66. If you are going to another city and find that you have
    a good show in that city, you can’t shop around for the box office, stand in a line and get the tickets.

    There we were holding, anticipating their forthcoming
    experience and joyously reliving the last one — Peter,
    Susan, Edmund, and Lucy, inside the guises of actors William Moseley
    (now a dashing 20-year-old), Anna Popplewell (a newly minted Oxford
    freshman), Skandar Keynes (with vocal octaves more deeply
    when he was 15), and Georgie Henley (approaching teenhood, an excellent six inches taller than we last saw her).
    Now you’ve taken that all-important 1st step and are reading
    this report about games and online community, you are within the unique and privideged position for being amongst a group of pioneering entreprenuers who know already relating to this and therefore are taking affirmative action.

  67. Hello there! Quick question that’s completely off topic.

    Do you know how to make your site mobile friendly?
    My web site looks weird when browsing from my iphone4.
    I’m trying to find a theme or plugin that might be able to resolve this
    issue. If you have any suggestions, please share. Appreciate it!

  68. My coder is trying to convince me to move to .net from PHP.

    I have always disliked the idea because of the costs. But he’s tryiong none the less.
    I’ve been using WordPress on a number of websites for about
    a year and am nervous about switching to another platform.
    I have heard great things about blogengine.net.
    Is there a way I can transfer all my wordpress posts into it?

    Any help would be greatly appreciated!

  69. Hello there! I know this is kind of off topic but I was wondering which
    blog platform are you using for this website?
    I’m getting fed up of WordPress because I’ve had issues
    with hackers and I’m looking at alternatives for another platform.
    I would be fantastic if you could point me in the direction of a good platform.

  70. Hi there! I could have sworn I’ve visited this web site before but after going through a few of the articles
    I realized it’s new to me. Anyhow, I’m definitely pleased I found
    it and I’ll be book-marking it and checking back frequently!

  71. I need to to thank you for this fantastic read!!
    I absolutely enjoyed every little bit of it.
    I have got you book-marked to look at new things you post…

  72. Very nice post. I just stumbled upon your weblog and wanted to say that I’ve really enjoyed surfing around your blog posts.
    After all I will be subscribing to your feed and I hope you write again soon!

  73. Hi my family member! I wish to say that this article
    is amazing, nice written and come with almost all important infos.
    I’d like to peer extra posts like this .

  74. Asking questions are really nice thing if you are
    not understanding something totally, however this paragraph gives fastidious understanding even.

  75. That is very fascinating, You’re a very professional blogger.
    I’ve joined your rss feed and sit up for in the hunt for more of
    your excellent post. Also, I’ve shared your web site in my social networks

  76. Hi there, just became aware of your blog through
    Google, and found that it is truly informative.

    I’m gonna watch out for brussels. I will appreciate if you continue this in future.
    A lot of people will be benefited from your writing.

    Cheers!

  77. My developer is trying to convince me to move to .net from PHP.
    I have always disliked the idea because of the expenses.
    But he’s tryiong none the less. I’ve been using WordPress on numerous websites for
    about a year and am anxious about switching to another platform.
    I have heard fantastic things about blogengine.net.
    Is there a way I can import all my wordpress posts into it?
    Any help would be really appreciated!

Lascia un commento

Il tuo indirizzo email non sarà pubblicato.