• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

How to call DLL file from VB6

larva

Member
Hi folks,

I used to call DLL from Visual C++ for my Smart Card reader/writer project as follows:

Inside .h file
------------------------------------
typedef U16 (*Autorize)
{
U8 *password;
}
public:
Authorize load;
HINSTANCE secure;

inside .c file
------------------------------------
secure = LoadLibrary("secure.dll");
load = (Authorize) GetProcAddress(secure,"DeviceActivePassword")


How can I call this in VB6 ? Thank you !

regards,
Larva

 

Under the Project menu, select references. Then, find the dll you want to add. If you can't find it on the list, either use REGSVR32.exe to register the dll with Windows, or click the Browse button and find it. Then you will have all the of the objects methods and stuff available to intellisense.

If the above doesn't work, you can still use the dll but you'll have to declare like you would a Windows API function.

Post back, if you need more information.
 
Based on the fact that he's calling LoadLibrary() and GetProcAddress(), he can't reference it from within VB as it's not a COM component, it's a standard DLL.

You would need to call it like this.

Private Declare Function YourFunctionName Lib "secure.dll" (parm1 As type, parm2 As type) As type

You're going to need to "map" the types between the exported functions in your DLL, and the declaration in VB. I don't have the signature for the function in your DLL so I can't provide it to you. If you give me the signature for the functions in your DLL, I could give you the VB equivalent. Using my example above, you can see that you'll need to replace "type" with the appropriate type that the exported function in your DLL requires.

 
Back
Top