GetPrivateProfileStringkeys
I'm having trouble with the GetPrivateProfileStringKeys API Call.
Here is the declaretion:
Declare Function GetPrivateProfileStringKeys& Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName$, ByVal lpszKey&, ByVal lpszDefault$, ByVal lpszReturnBuffer$, ByVal cchReturnBuffer&, ByVal lpszFile$)
If you have information or code how to use this function i would appreciate it, or just a full module with all the INI API Calls with comments.
What I want to do is list all the Keys in an INI under the 'Application' Templates.
'Example:
[Templates]
Name1=blah
Name2=blah
Name3=blag
and add each of the 'Keys' to a listbox.
Thanks for your time!
Re: GetPrivateProfileStringkeys
Quote:
Originally posted by jasper_punx0r
I'm having trouble with the GetPrivateProfileStringKeys API Call.
Here is the declaretion:
Declare Function GetPrivateProfileStringKeys& Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName$, ByVal lpszKey&, ByVal lpszDefault$, ByVal lpszReturnBuffer$, ByVal cchReturnBuffer&, ByVal lpszFile$)
If you have information or code how to use this function i would appreciate it, or just a full module with all the INI API Calls with comments.
What I want to do is list all the Keys in an INI under the 'Application' Templates.
'Example:
[Templates]
Name1=blah
Name2=blah
Name3=blag
and add each of the 'Keys' to a listbox.
Thanks for your time!
i did not find an api by the name getprivateprofilestringkeys but i certainly can help you out with getprivateprofilestring api
here is a sample code
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (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
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Private Sub Form_Load()
Dim Ret As String, NC As Long
'Write the setting to the file (c:\test.ini) under
' Project1 -> Keyname
WritePrivateProfileString App.Title, "KeyName", "This is the value", "c:\test.ini"
'Create a buffer
Ret = String(255, 0)
'Retrieve the string
NC = GetPrivateProfileString(App.Title, "KeyName", "Default", Ret, 255, "C:\test.ini")
'NC is the number of characters copied to the buffer
If NC <> 0 Then Ret = Left$(Ret, NC)
'Show our string
MsgBox Ret
'Delete the file
Kill "c:\test.ini"
End Sub
i hope this is helpful