473,394 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

crazy DLL resources

Hi,

I'm still with my problem of string resource to load from a C++ DLL.

Here is my code :
in my module i have the function for loading DLL and sending back a string to main form.
where MyForm is the reference to my main form and MyLanguage is in fact, the file name of my DLL to load...for example "english.dll"

Function ChangeLanguage(ByRef MyForm As FMain, ByVal MyLanguage As String) As Boolean
Dim strFilePath As String
Dim hLibrary As Long
Dim strString As String
Dim lngStringLen As Long

' Get the path to the Resource DLL
strFilePath = System.IO.Directory.GetCurrentDirectory
strFilePath = strFilePath & "\" & MyLanguage

' Load the Resource DLL
hLibrary = FMain.LoadLibrary(strFilePath)
If hLibrary = 0 Then
MsgBox("Failed to load the specified library with error code " & Err.LastDllError)
Exit Function
End If

Dim MyString As String

' Get a string from the Resource DLL
strString = ""

Try
lngStringLen = FMain.LoadString(hLibrary, 10001, strString, Len(strString))
'If lngStringLen <> 0 Then Me.Caption = Left(strString, lngStringLen)
Catch
MsgBox("Error during loadString...", MsgBoxStyle.Exclamation Or MsgBoxStyle.OKOnly, "Error in DLL function")
End Try

MyForm.Refresh()

' Close the Resource DLL
FMain.FreeLibrary(hLibrary)
End Function

in my main form, i have my DLL functions declared like that :

Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long

Public Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long

Public Declare Function LoadString Lib "user32" Alias _
"LoadStringA" (ByVal hInstance As Long, ByVal wID As Long, _
ByVal lpBuffer As String, ByVal nBufferMax As Long) As Long

-------------------
i still have the same problem, in LoadString, but i don't understand why and where ?
if try ...catch is not here...i have error message : "An unhandled exception of type 'System.NullReferenceException' occurred in DLL_test1.exe"

thanks to help me, because i'm becoming crazy with this error :(

Maileen
Nov 21 '05 #1
1 1085
Hi Maileen,

Your Declares are buggy.
See my response to your previous post for details.

Roman

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: doltharz | last post by:
Please Help me i'm doing something i though was to be REALLY EASY but it drives me crazy The complete code is at the end of the email (i mean newsgroup article), i always use Option...
32
by: Chumbo | last post by:
If I have this(please bear with me - this is a case of a former java guy going back to C ;-) int main () { char *tokconvert(char*); char str = "dot.delimited.str"; char *result; result =...
5
by: Lee | last post by:
Hi, I am saving a forms location by getting the x and y coordinates as such;- this.Location.X.ToString(); this.Location.Y.ToString(); when i again load the form i am using the saved x and y...
3
by: squash | last post by:
I have spent two hours trying to make sense of this script, called crazy.php. The output should be nothing because $cookie_password is nowhere defined in this script, correct? But it actually...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.