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: 5.6 (September/October 2007)
Author: Christian Schmitz
Article Description: No description available.
Article Length (in bytes): 6,718
Starting Page Number: 44
RBD Number: 5617
Resource File(s):

Download Icon 5617.zip Updated: Friday, September 14, 2007 at 7:40 PM

Related Link(s): None
Known Limitations: None

Excerpt of article text...

All Windows versions should be equal to 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. For Mac OS see the listing for a nice version function in Listing #1.

Collection version data for Windows

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

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 get this declare:

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

This function was extended around Windows 2000 so we try first to call the function with a 156 byte Memoryblock asking for the information. If we run on an old Windows version it will reject our request because of a mismatch in the memoryblock size, so we ask in this case again with a smaller block. We store in the first long inside the memoryblock the size of our block so Windows knows how much data it can savely 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