Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Easy API Question?
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00258567
Message ID:
00259209
Views:
25
>>>>Hi George - Of course you're right. I thought there was a problem with win32api declaration, but of course it was due to my dumb 'case' mistake. I'll change the code appropriately :)
>>>
>>>Hi Bruce, It isn't that USER32 is wrong (it isn't), just unnecessary. The easiest way I know to avoid spelling and/or case mistakes when dealing with the API is to simply copy the declaration from either the Win32 SDK or the MSDN Library. Quite frankly, I can never remember the entire list of what's searched. If I find that it can't find the entry point, then I my first reaction is to check what the import library is and use that.
>>
>>But keeping the api call generic with win32api seems like a better way to go than using specific DLLs, isn't it? I only used the user32 because of this:
>
>It isn't very likely that a function will be moved from its original library, so it's hard to try to quantify which is better. I use the Win32API identifier myself. But only because I'm lazy< g >. However, an argument could be made that someone coming from another language (say VB, where you have specify the library) might find not using the exact name confusing. I don't think it'd be a terribly strong argument, however.
>

Another vote here for lazy, but with mitigating circumstances. Some API calls are handled by different .DLLs under Win9x and WinNT; the WIN32API catchall hides this difference in most cases. OTOH, it can bite your behind, too - if you use GetLastError() declared with the WIN32API catachall, you'd better declare it in advance, because if you declare it afterwards, you';; get the wrong error code back (because WIN32API figures out which DLL the API call is in by trying to get it from each .DLL, and if it doesn't find it in the first, it gets an error code and goes to the next...)

>>declare integer GetDeskTopWindow in win32api
>>
>>errors. But
>>
>>declare integer GetDeskTopWindow in user32.dll
>>
>>does not error. Of course, the error comes later, when you try to invoke it. By which time I was pretty thoroughly confused :)
>
>Oh, I could tell you some stories, Bruce.:-) Working with the API can do that to you.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform