Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detecting registered functions
Message
From
09/06/1999 12:53:46
 
 
To
09/06/1999 01:25:04
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00227758
Message ID:
00227985
Views:
20
>>The DECLAREs will occur exactly once, when the object is instantiated from the class; if the object is scoped globally to the app (either added to a common VFP object like _SCREEN via ADDOBJECT(), or created as a PUBLIC variable, then you can simply check if the object exists and create it if it doesn't:
>
>This method has one weakness: any CLEAR DLLS as well as any other DECLARE of the same function but with different name/paras/return_value will break it. EVen if it works today with the existing code, nobody can be sure that future code (in-house or third-party) will not break it.
>
>So, DECLARE any dll function where/when it is used. The overhead is minimal. The advantage is, as always, solid code.
>
You're preaching to the choir here! If you take a look at all three of my downloadable files here on UT, you'd see that's exactly what I do.

The important problem here in all likelihood is to only call the initialization entrypoint once, and wrapping the API use within an object accomplishes that - if the object is scoped globally and doesn't get released or (or the parent doesn't do a RemoveObject), the visible presense of that object within the app, does accomplish this task. I've never seen a situation where redeclaring an API call in DECLARE...DLL did anything bad, but since I don't know the specifics of the .DLL in question, I'll let the guy who's got the docs tell me the conditions of contest!
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
Next
Reply
Map
View

Click here to load this message in the networking platform