Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem In calling DLL Function from VB

Status
Not open for further replies.

0100

Programmer
Sep 9, 2003
6
0
0
FR
Hi all


when executing my VB Code it tells me that
=>>error : DLL Call Convention is incorrect ...


Here are the essential lines i wrote in my VB code to use the DLL function :

________________________________________________________
Public Declare Function CWorkingDir Lib ".\MyDll.dll"
(ByVal WorkingDir As String) As Integer

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 Const DEF_MY_DLL As String =".\MyDll.dll"

........
.......
Sub Main()

.......
Dim intVar As Integer
IntRet = LoadLibrary(DEF_MY_DLL)
.......
intVar = CWorkingDir(".")
.......
end Sub
_____________________________________________________

Ps : MyDll is a simple DLL without Class but only simple function exported in the conventional way

Please is there any suggestion or solution

thanx in advance

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top