|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
C++ dll used in VB codeI've created 2 dll with VC++, which are only resource dlls. in fact, only strings are inside. IDS_String101 101 Welcome IDS_String102 102 Bye where IDS_Stringxxx is the ID, 101 is the valueID and Welcome the value of this string to load and display resource string dll value, here is my code : ' Load the Resource DLL hLibrary = LoadLibrary("myapp\english.dll") If hLibrary = 0 Then MsgBox "Failed to load the specified library with error code " & Err.LastDllError Exit Sub End If ' Get a string from the Resource DLL dim strString as string dim lngStringLen as Long lngStringLen = LoadString(hLibrary, 101, strString, Len(strString)) Form1.Label1.Text = Left(strString, lngStringLen) but an error occur on : lngStringLen = LoadString(hLibrary, 101, strString, Len(strString)) something like systemNull.xxxx why ? thanks a lot, Maileen
Show quote
Hide quote
"Maileen" <noemail@nospam.com> wrote in message Try initializing the variable strString before using it:news:ur$lZysvFHA.664@tk2msftngp13.phx.gbl... > Hi, > > I've created 2 dll with VC++, which are only resource dlls. > in fact, only strings are inside. > > IDS_String101 101 Welcome > IDS_String102 102 Bye > > where IDS_Stringxxx is the ID, 101 is the valueID and Welcome the value of this string > > to load and display resource string dll value, here is my code : > > ' Load the Resource DLL > hLibrary = LoadLibrary("myapp\english.dll") > If hLibrary = 0 Then > MsgBox "Failed to load the specified library with error code " & Err.LastDllError > Exit Sub > End If > ' Get a string from the Resource DLL > dim strString as string > dim lngStringLen as Long > lngStringLen = LoadString(hLibrary, 101, strString, Len(strString)) > Form1.Label1.Text = Left(strString, lngStringLen) > > but an error occur on : > lngStringLen = LoadString(hLibrary, 101, strString, Len(strString)) > > something like systemNull.xxxx > why ? > > thanks a lot, > Maileen strString = String(255, 0) If you don't initialize it first then Len(strString) will return 0. Jim Edgar |
|||||||||||||||||||||||