ChrisCarroll
Programmer
- Oct 10, 2000
- 177
Can anyone help ...
WritePrivateProfileString works fine- the file C:\(windir)\test.ini is correctly updated each time.
But cResult always comes back unchanged. How do I Get the setting?
I got the WinAPI signatures from VB4 help files - they both register as given, so I assume they're correct. I'm running on NT4
WritePrivateProfileString works fine- the file C:\(windir)\test.ini is correctly updated each time.
But cResult always comes back unchanged. How do I Get the setting?
I got the WinAPI signatures from VB4 help files - they both register as given, so I assume they're correct. I'm running on NT4
Code:
Public iWritePPString, iGetPPString, cReturn, cDefault
Set library to FoxTools
iWritePPString= RegFn("WritePrivateProfileString", "CCCC", "L")
*(ByVal lpApplicationName As String,
* ByVal lpKeyName As Any,
* ByVal lpString As Any,
* ByVal lpFileName As String)
iGetPPString= RegFn("GetPrivateProfileString", "CCC@CLC", "L" , "krnl386.exe")
* That's hopefully an ampersand you see in the signature
* (ByVal lpApplicationName As String,
* ByVal lpKeyName As Any,
* ByVal lpDefault As String,
* ByVal lpReturnedString As String,
* ByVal nSize As Long,
* ByVal lpFileName As String) As Long
* Get ready ...
Clear
cReturn= Repl("_", 15)
cDefault=Repl("*",15)
i=0
? cReturn, cDefault, i
* Write & Read to ini file
i= CallFn(iWritePPString, "FoxPro", "Setting3", TRIM(str(Rand()*1000, 3,0)) , "Test.ini")
i= CallFn(iGetPPString, "FoxPro", "Setting3", cDefault, @cReturn, 15, "Test.ini")
* Show results
? cReturn, cDefault, i
modi file c:\winnt\test.ini nowait