Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can I detect NT hardware profiles using the API?
Message
 
 
À
13/08/2001 15:40:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00542368
Message ID:
00543258
Vues:
16
Jim,
To see if it is supported under Win98SE, you can use the Depends.Exe utility that comes with Visual Studio 6. Open AdvAPI32.DLL (found under your System/System32 directory). Scroll through the list of functions to see if GetCurrentHwProfileA or GetCurrentHwProfileW is listed. If not, then it is not supported.

The code below ran under W2K SP1 and I don't have access to any Win98 machines at all to test it. I may be able to test it under Win95 this evening but I don't know how much information that will gain you.

>
>>declare integer GetCurrentHwProfile in advapi32 string@
>>declare integer GetLastError in kernel32
>>lcdocked = chr(1)+replicate(chr(0),3)  && equates to desktop computers (always docked)
>>lcguid = replicate(chr(0),39)  && room for GUID identifier along with brackets and null terminator
>>lcname = replicate(chr(0),80)  && room for name of profile (80 character limit)
>>lcstruct = lcdocked+lcguid+lcname
>>if GetCurrentHwProfile(@lcstruct) <> 0 then
>>  * it worked
>>  ? substr(lcstruct,4,39)  && prints GUID identifier
>>  ? substr(lcstruct,44,80) && prints name of profile with trailing null terminiators (you can trim these using at() to find first occurrence)
>>else
>>  ? GetLastError()
>>endif
>>
>>HTH.
>
>Well, I run it once, I get an '87' error, The parameter is incorrect.
>On a second immediate run, I get a '120', This function is not supported on this system. I am testing under Win98SE, docs say it is supported. The docking info "dwDockInfo - A set of bit flags that indicate the docking state of the computer. This member can be a combination of the following values." is indicated as type DWORD. Can I really get by this easily? Thanks, Larry.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform