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):
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.
|










