Y
yxq
Hello,
I want to get the string resource from DLL file, the code work well for
Vista x86, but it will not work on Vista x64, why? can anyone help to view
the code below? thank you very much.
//////////////////////////////////////////////////////////////////////////////////
Public Class GetResourceStringFromFile
Private Declare Function LoadLibrary Lib "kernel32" Alias
"LoadLibraryA" (ByVal lpLibFileName As String) As Integer
Private Declare Function LoadString Lib "user32" Alias "LoadStringA"
(ByVal hInstance As Integer, ByVal uID As Integer, ByVal lpBuffer As String,
ByVal nBufferMax As Integer) As Integer
Private Declare Function FreeLibrary Lib "kernel32" (ByVal
hLibModule As Integer) As Integer
Public Shared Function GetResourceStringFromFile(ByVal sModule As
String, ByVal idString As Integer) As String
Dim hModule As Integer
Dim nChars As Integer
Dim Buffer As New
Microsoft.VisualBasic.Compatibility.VB6.FixedLengthString(260)
Dim ReturnValue As String = ""
Try
hModule = LoadLibrary(sModule)
If hModule Then
nChars = LoadString(hModule, idString, Buffer.Value,
260)
If nChars > 0 Then
ReturnValue =
Microsoft.VisualBasic.Left(Buffer.Value, nChars)
End If
FreeLibrary(hModule)
End If
Catch ex As Exception
End Try
Return ""
End Function
End Class
I want to get the string resource from DLL file, the code work well for
Vista x86, but it will not work on Vista x64, why? can anyone help to view
the code below? thank you very much.
//////////////////////////////////////////////////////////////////////////////////
Public Class GetResourceStringFromFile
Private Declare Function LoadLibrary Lib "kernel32" Alias
"LoadLibraryA" (ByVal lpLibFileName As String) As Integer
Private Declare Function LoadString Lib "user32" Alias "LoadStringA"
(ByVal hInstance As Integer, ByVal uID As Integer, ByVal lpBuffer As String,
ByVal nBufferMax As Integer) As Integer
Private Declare Function FreeLibrary Lib "kernel32" (ByVal
hLibModule As Integer) As Integer
Public Shared Function GetResourceStringFromFile(ByVal sModule As
String, ByVal idString As Integer) As String
Dim hModule As Integer
Dim nChars As Integer
Dim Buffer As New
Microsoft.VisualBasic.Compatibility.VB6.FixedLengthString(260)
Dim ReturnValue As String = ""
Try
hModule = LoadLibrary(sModule)
If hModule Then
nChars = LoadString(hModule, idString, Buffer.Value,
260)
If nChars > 0 Then
ReturnValue =
Microsoft.VisualBasic.Left(Buffer.Value, nChars)
End If
FreeLibrary(hModule)
End If
Catch ex As Exception
End Try
Return ""
End Function
End Class