Yep...approximate speed of CPU speed is stored in the registry (WinNT only). Windows95/98 don't have that and there's no direct way of finding that out (No API or atleast I couldn't find one).
For API declaration:
VB's API viewer has the wrong declaration of a SYSTEM_INFO structure (maybe it's not the wrong one, but the way it's declared, it won't give you the CPU level and revision).
Look at this C declaration of the SYSTEM_INFO:
Now, look at the API's viewer declaration:Code:typedef struct _SYSTEM_INFO { union { DWORD dwOemId; struct { WORD wProcessorArchitecture; WORD wReserved; }; }; DWORD dwPageSize; LPVOID lpMinimumApplicationAddress; LPVOID lpMaximumApplicationAddress; DWORD dwActiveProcessorMask; DWORD dwNumberOfProcessors; DWORD dwProcessorType; DWORD dwAllocationGranularity; WORD wProcessorLevel; WORD wProcessorRevision; } SYSTEM_INFO;
Notice in C declaration the Union keyword? It tells the compiler that the element of that structure would be either the dwOemId or the structure of wProcessorArchitecture and wReserved (It will take the biggest value for the memory storage), BUT...VB doesn't have that luxury. (Using Union), plus in MSDN Library it says that dwOemId is obsolete, which is true but it won't work without it in VB. So, it was just a matter of time porting this declaration to VB. Once again....always use MSDN....sometimes it has all the answers, sometimes not.Code:Private Type SYSTEM_INFO dwOemID As Long dwPageSize As Long lpMinimumApplicationAddress As Long lpMaximumApplicationAddress As Long dwActiveProcessorMask As Long dwNumberOrfProcessors As Long dwProcessorType As Long dwAllocationGranularity As Long dwReserved As Long End Type
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819




Reply With Quote