Using non-COM dll with VB.Net

tkoch

New member
Joined
Mar 6, 2006
Messages
2
Programming Experience
Beginner
I am writing an app that needs to use a dll to read some files. The dll came with a demo vb 6.0 project. When I open the project in vb.net 2005, it completes the import wizard and runs perfectly. When I make a new project in vs.net 2005 and copy the code exactly and run the app, I get

An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

the code to access the dll is:

Declare Function LoadBRW Lib "libBRW.dll" (ByVal lpstring AsString) As Short
Declare Function UnloadBRW Lib "libBRW.dll" () As Integer
Declare Function GetFieldByID Lib "libBRW.dll" (ByVal fID AsInteger) As String
Declare Function GetFieldByName Lib "libBRW.dll" (ByVal lpString As String) AsString
Declare Function SaveBRW Lib"libBRW.dll" (ByVal lpString AsString) As Integer
Declare Function SetFieldByID Lib "libBRW.dll" (ByVal fID AsInteger, ByVal lpString AsString) As Integer


It always gives the error when i try to use LoadBRW(path) - but it works perfectly on the project imported from the vb6 code.

What can I do?
 
just a slingshot, but try to change all the ByVal to ByRef for the declares
 
Back
Top