Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Intel corner

Windows Version

Asking for the correct Windows version from REALbasic Code using Declares

Issue: 1.5 (April/May 2003)
Author: Christian Schmitz, cSchmitz-at-rbdeveloper.com
Author Bio: Christian Schmitz has written several articles for the German magazine Macwelt and has made many cross-platform applications using REALbasic.
Article Description: No description available.
Article Length (in bytes): 6,236
Starting Page Number: 37
RBD Number: 1519
Resource File(s):

Download Icon 1519.sit Updated: Friday, October 17, 2003 at 12:20 PM

Related Web Link(s):

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/sysinfo_92jy.asp
http://msdn.microsoft.com/library/en-us/sysinfo/sysinfo_3a0i.asp
http://msdn.microsoft.com/library/en-us/sysinfo/sysinfo_1o1e.asp

Known Limitations: None

Excerpt of article text...

All Windows versions should be treated as equals by you, as the programmer, but some are different -- so if a customer has a problem, you might ask him what Operation System he is using. Code Listing #1 shows how this can be done for the Mac OS.

Collecting Version Data for Windows

For Windows it's a little bit complicated. First we will make a Declare statement to the function GetVersionEx, which returns the version information record. Then we have to interpret it, but let's start with the declare. The C code looks like this:

BOOL GetVersionExA(LPOSVERSIONINFO lpVersionInfo);

As you can see it's just a boolean function with a pointer (lp is short for a long pointer) pointing to a memoryblock. So we create this declare:

Declare function GetVersionExA lib "KERNEL32" (versioninfo as ptr) as boolean.

This function was extended around Windows 2000 so we'll first try to call the function with a 156 byte memoryblock asking for the information. If we run on an older Windows version it will reject our request because of a mismatch in the memoryblock size, so in this case we'll ask again with a smaller block. In the first long inside the memoryblock, we'll store the size of our block so Windows knows how much data it can safely place into the block.

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com