General information
Category:
Windows API functions
>Can someone explain how and when to use DECLARE DLLs?
>
>I see the following code in the sample Tastrade app and don't
>understand it.
>
>*-- DECLARE DLL statements for reading/writing to private INI files
>DECLARE INTEGER GetPrivateProfileString IN Win32API AS GetPrivStr ;
> String cSection, String cKey, String cDefault, String @cBuffer, ;
> Integer nBufferSize, String cINIFile
>
>Perhaps there are other APIs that I could/should be using. Can
>someone do a better job of explaining them than what is in
>the VFP help file?
Example:
* You have to initialize the string first
lcbufferstring = space(100)+chr(10)
* The function returns the length of the requested value
* and stores the value in LCBUFFERSTRING
lnlenstring = getprivstr("WindowPreferences", ;
"Executive Alias", ;
"", ;
@lcbufferstring, ;
len(lcbufferstring), ;
"EL.INI")
if lnlenstring > 0
lcbufferstring = subs(lcbufferstring,1,lnlenstring)
else
lcbufferstring = ""
endif
In EL.INI:
[WindowPreferences]
Executive Alias=e_main_all
lnlenstring = 10
lcbufferstring = "e_main_all"
Not too tough once you understand what they needs. It helps to put wrappers (either in a class or UDF) around them.
paul
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only