Aurelien
13 years agoContributor
Call function from C++.dll
Hi,
I tried to call a function from C++.dll but without success. Here is my code in VBS:
Options Explicit
Sub TestCallDll
Dim Def_Environment, Def_DLL, activated, lib
Set Def_Environment = DLL.DefineEnvironment(True)
Set Def_DLL = Def_Environment.DefineDLL("MetrinoPlatformWin32")
Call Def_DLL.DefineProc("pft_IsOptionActivated", vt_Int, vt_Int, vt_Int, vt_Int, vt_Int, vt_Bool)
Set lib = Def_Environment.Load("C:\Program Files\Common Files\Gerico\Bin\MetrinoPlatformWin32.dll")
Call lib.pft_IsOptionActivated(0, 0, 0, 15, 1, activated)
End Sub
The information provided by the developer in c#:
bool
activated;
My error is at the line: Call lib.pft_IsOptionActivated(0, 0, 0, 15, 1, activated)
Error message: Object doesn't support this property or method: 'lib.pft_IsOptionActivated'
Could someone tell me where I am wrong please?
Thanks and regards
PS: I have a poor experience in programing.
I tried to call a function from C++.dll but without success. Here is my code in VBS:
Options Explicit
Sub TestCallDll
Dim Def_Environment, Def_DLL, activated, lib
Set Def_Environment = DLL.DefineEnvironment(True)
Set Def_DLL = Def_Environment.DefineDLL("MetrinoPlatformWin32")
Call Def_DLL.DefineProc("pft_IsOptionActivated", vt_Int, vt_Int, vt_Int, vt_Int, vt_Int, vt_Bool)
Set lib = Def_Environment.Load("C:\Program Files\Common Files\Gerico\Bin\MetrinoPlatformWin32.dll")
Call lib.pft_IsOptionActivated(0, 0, 0, 15, 1, activated)
End Sub
The information provided by the developer in c#:
bool
activated;
pft_IsOptionActivated(0, 0, 0, 15, 1, out activated);
canRun =
activated;
[DllImport("MetrinoPlatformWin32.dll", EntryPoint =
"pft_IsOptionActivated",
SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
internal static
extern void
pft_IsOptionActivated(int card, int link, int unit, int slot, int
optionIndex, [MarshalAs(UnmanagedType.I1)] out
bool activated);
My error is at the line: Call lib.pft_IsOptionActivated(0, 0, 0, 15, 1, activated)
Error message: Object doesn't support this property or method: 'lib.pft_IsOptionActivated'
Could someone tell me where I am wrong please?
Thanks and regards
PS: I have a poor experience in programing.