Use C++ DLL with VB6

前端 未结 5 1457
自闭症患者
自闭症患者 2021-01-06 12:38

I just created a DLL for my boss in MSVC++2010. I selected \"New Win32 DLL\" with option \"Export symbols\", so, everything is completely standard. There are some predefined

5条回答
  •  余生分开走
    2021-01-06 12:51

    Yeah, VB6 doesn't work like that. You need to declare the DLL functions in your VB code somewhat like this:

    Private Declare Function WinHelp Lib "user32" Alias "WinHelpA" _
      (ByVal hwnd As Long, ByVal lpHelpFile As String, _
      ByVal wCommand As Long, ByVal dwData As Long) As Long
    

    You would replace "user32" with "MyCPlusPlusDLL.dll" and use the actual method names and signatures etc. from your DLL. Then put the DLL in your /System folder and you should be good to go.

    Note: this is assuming that the methods inside your C++ DLL are declared with "__declspec".

提交回复
热议问题