Link to home
Start Free TrialLog in
Avatar of kwkaan
kwkaan

asked on

GetPrivateProfileString Lib "kernel32" or "kernel"?

I'm running a VB program but encounter some problem:

System tried to get the parameter value in *.ini file using command "GetPrivateProfileString".  Before that, I declare the function "GetPrivateProfileString":

Declare Function GetPrivateProfileString Lib "Kernel" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Integer, ByVal lpFileName As String) As Integer


Public Sub GetIniValue(ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal iniPath As String, lpReturnedString As String)

    Dim ret As Long
    lpReturnedString = Space$(60)
    ret = GetPrivateProfileString(lpApplicationName, lpKeyName, "", lpReturnedString, 60, iniPath)
   
    If ret = 0 Then
        MsgBox "Error"
    End If
    lpReturnedString = Left$(lpReturnedString, InStr(1, lpReturnedString, Chr$(0)) - 1)
End Sub

But system returned:  Error Initialize program:  File not found:  Kernel, in the line "GetPrivateProfileString".

Then I tried to declare the function using "kernel32".

System returned:  Can't find DLL entry point GetPrivateProfileString in Kernel32 from SIMain

I'm using Windows 2000 Professional, with VB6.0
ASKER CERTIFIED SOLUTION
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kwkaan
kwkaan

ASKER

thanks!!
:-) why a C?