09.01.2020

Delphi Get Windows Version Vista

Hi, we use a manifest file for our application which runs on XP and Vista. On Vista some of our windows get kind of smaller thereby our controls get covered or on some windows, the controls become slightly bigger and cut into the window border.Has anyone faced this situation? Is making the window larger and adjusting the space for the controls the only solution?Reason I ask is because this scenario does not occur on XP and so the windows will appear slightly larger on XP than on Vista.Thank you,Ram. Quote Ram wrote: Hi, we use a manifest file for our application which runs on XP and Vista. On Vista some of our windows get kind of smaller thereby our controls get covered or on some windows, the controls become slightly bigger and cut into the window border. Has anyone faced this situation? Is making the window larger and adjusting the space for the controls the only solution?

Reason I ask is because this scenario does not occur on XP and so the windows will appear slightly larger on XP than on Vista.D5 stores the form width and height in the DFM files, and this includesthe non-client area (caption, border, menu bar). If those happen to belarger on the users system the forms client area will be reduced.

Thisproblem could also happen on pre-Vista systems, since the user canconfigure the font to use for captions, for example. The only solutionfor you is to adjust the form size and the positions and sizes ofcontrols anchored to bottom or right at run-time.-Peter Below (TeamB)Don't be a vampire (the newsgroup archives:http://www.tamaracka.com/search.htmhttp://groups.google.com.

Quote Peter Below (TeamB) wrote: Ram wrote: Hi, we use a manifest file for our application which runs on XP and Vista. On Vista some of our windows get kind of smaller thereby our controls get covered or on some windows, the controls become slightly bigger and cut into the window border. Has anyone faced this situation? Is making the window larger and adjusting the space for the controls the only solution? Reason I ask is because this scenario does not occur on XP and so the windows will appear slightly larger on XP than on Vista.What I do is have a panel that covers the entire form aligned toalClient.

Then when the form is shown I do this:procedure TTntFormOptionsGeneral.FormShow(Sender: TObject);begininherited;ClientWidth:= TPanel1.Width;ClientHeight:= TPanel1.Height;end;As Peter stated it 'expands' the main form size to corretly hold thePanel without covering any of it. Where this also is necessary ifsomeone changes the size of the font. Run you 'correctly' working appin XP then then reset the system font to large font. You will see thesame problem. The VCL will correctly handle everything except the sizeof the main form. By doing the above it will expand the size of themain form to corretly show all the controls when the system font sizeis changed as well.Jim-www.mustangpeak.net.

Quote 'Jim' wrote:Peter Below (TeamB) wrote: Ram wrote: Hi, we use a manifest file for our application which runs on XP and Vista. On Vista some of our windows get kind of smaller thereby our controls get covered or on some windows, the controls become slightly bigger and cut into the window border. Has anyone faced this situation? Is making the window larger and adjusting the space for the controls the only solution? Reason I ask is because this scenario does not occur on XP and so the windows will appear slightly larger on XP than on Vista.What I do is have a panel that covers the entire form aligned toalClient.

Then when the form is shown I do this:procedure TTntFormOptionsGeneral.FormShow(Sender: TObject);begin inherited; ClientWidth:= TPanel1.Width; ClientHeight:= TPanel1.Height;end;As Peter stated it 'expands' the main form size to corretly hold thePanel without covering any of it. Where this also is necessary ifsomeone changes the size of the font. Run you 'correctly' working appin XP then then reset the system font to large font. You will see thesame problem. The VCL will correctly handle everything except the sizeof the main form. By doing the above it will expand the size of themain form to corretly show all the controls when the system font sizeis changed as well.Jim-www.mustangpeak.net.

The new functions they point you to are existence tests more than version returning functions, so you'd have to call them with every number possible until it starts failing in order to return a version number from them. Of course, then piecing a full version string from there shouldn't be a problem.The 'problem' I think that's coming from this is that Microsoft has designed to make versioning irrelevant in their OSes. At least from an API standpoint. The major thing that seems to indicate version is the application compatibility manifest (as noted, GetVersionEx will return the correct answer if 8.1 compatibility is indicated there).I can't say I know all the ins and outs of this, but I'm thinking of playing around. Maybe try GetVersionEx with an app manifest indicating only vista support and see if it returns 6.0 or not.

Maybe try the same with these applications. I'm thinking perhaps with the concern of compatibility, the application is the one that determines version more than the OS. Which means the app compatibility manifest is a requirement.Right now, the only thing I'm completely sure of in discovering this is that it'll be an issue. What it means exactly and how to address it is something I've yet to figure out.(FWIW, I can add some stuff about the application compatibility manifest to that FAQ if necessary.)RE: How To Get The OS Version.

The 'problem' I think that's coming from this is that Microsoft has designed to make versioning irrelevant in their OSes. At least from an API standpoint. The major thing that seems to indicate version is the application compatibility manifest (as noted, GetVersionEx will return the correct answer if 8.1 compatibility is indicated there).(FWIW, I can add some stuff about the application compatibility manifest to that FAQ if necessary.)If you would like, I could go ahead and add that to the FAQ?RE: How To Get The OS Version. (Programmer) 19 Nov 15 07:55. The stuff in the file you included basically does the same stuff we've been talking about and using over the years.

Delphi

One is another person's translation of versionhelpers.h, which is what the FAQ I posted is, basically. The other one is an attempt to translate the output of GetVersionEx to something akin to the OS branding.Neither will help anything at all, since Microsoft has left the 'versioning' to the application at hand. More or less that means the programmer decides the 'version' of the program through the 'stupid manifest requirement from MS'. It probably was preferable anyway, because the programmer can dictate what OS the program.should. run on through his own testing and then Microsoft can apply appropriate settings to the program on the fly when it's run.I'll post how to do an application compatibility manifest into the FAQ. More or less, it'll catch one or two other issues as well (namely UAC considerations), but it'll be good to do all of it.

How To Check Windows Version

I'm sure the sparking new Delphis have been redone to present these options to the programmer, but what I'll post will be good for most all Delphis. I use it under Delphi 3, myself.RE: How To Get The OS Version. (Programmer) 19 Nov 15 08:48. Good idea, but pls check also the code I send you. I know most of it is identical (more or less) to what you did, nut the main unit (which does not compile) does other things as well. The compiler stops at 'TOSVersionInfoEx' as undeclared identifier.

When you leave out the 'Ex' is does compile and then the 'FOStype' changes between OS'es, but not exactly according to the enumeration given. XP returns correct, nut W7 and W10 are incorrect.I am still using Delphi 7. Tried all the other ones up to XE5 but find D7 still by far the best and most stable.Cheers,JoopRE: How To Get The OS Version. Good idea, but pls check also the code I send you.

I know most of it is identical (more or less) to what you did, nut the main unit (which does not compile) does other things as well.Evidently what the code you linked to is doing is calling with the extended parms as opposed to the standard ones. Interestingly enough, the call with the extended info returns 6.3, but as Microsoft has stated, it is best to use the manifest if you're interested in more full compatibility. If the non-extended call fails, I'm sure the extended one will fail soon enough.To correct the source file you have (developed in Free Pascal I believe) so it'll compile, add to winosversion.pas. I added the manifest according to your instructions and now it works.I modified my own check procedures to accommodate Win81 and Win10 and now it works fine.I attached a zip with a demo program including all sources.Due to this 'automatic' adjusting of MS, my GUI looks quite different on Windows 10 compared to Win7 and WinXP.Something I really and absolutely dislike. I like to be in control when it comes to GUI layout and MS should keep their hands off.Thanks for your help and advise.Cheers,Joop.RE: How To Get The OS Version.

Windows

Due to this 'automatic' adjusting of MS, my GUI looks quite different on Windows 10 compared to Win7 and WinXP.Something I really and absolutely dislike. I like to be in control when it comes to GUI layout and MS should keep their hands off.They never did keep it consistent between versions (or now themes as the user changes them). Always different fonts and sizes and the like that would change things up. FWIW, you can disable the theming behavior via code within your application (I have that here), or delete that section in the manifest when you use it. Though the end user will likely find it strange that your program doesn't obey the theme scheme and will find it 'odd' or 'old'.