Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetVersionEx - wrong when debugging 1

Status
Not open for further replies.

donvittorio

Programmer
Jul 17, 2003
122
GB
Hi,

I'm using Delphi 4 (not through choice!) and Windows XP, and I'm getting some odd behaviour when calling the Windows API function GetWindowsEx.
If I run in debug mode (i.e. from Delphi) this incorrectly returns MajorVersion = 4, MinorVersion = 0 (which is Windows NT). If I run the executable outside of Delphi it correctly returns MajorVersion = 5, MinorVersion = 1.
I need to write some code that only executes on XP, so this is seriously hampering my ability to debug my code!
If anybody has any ideas why this is happening I'd be very interested to hear them

Thanks

Steve
 
Did you set compatibilty-mode on the Delphi32.exe shortcut? If set for Windows 98 or Windows NT it should return that versioninfo, but return the real OS-version because you didn't set it for your compiled app ;-)

HTH
TonHu
 
If you can't get it working (may be Win is masking the version it sends to D4) you have some other options:

1) Use an {$IFDEF DEBUGGING} to not check the version in debug builds. Define and undefine the DEBUGGING directive in the IDE conditionals (Project/Options) to make debug builds or final builds.

2) Add a command line parameter to your app (say: /DEBUGGING) and use it in the IDE Run/Parameters options. If you find it in the command line do not check the version.

3) Detect if you are running under the IDE and do not check the version.

buho (A).
 
TonHu,

that was it, thanks! I've been using Delphi for about 7 years, and I never even knew that setting was there

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top