Home > Back-end > Questions about VB DLL function called BCB
Questions about VB DLL function called BCB
Time:10-04
Write a DLL in vb6, output is a function, the code is as follows: Option Explicit Public Function PT (H As String) As String . The code . PT=trim (H) End the Function -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Generate MyDLL. DLL, through special compiled, output function, PT concrete method many online (http://www.pconline.com.cn/pcedu/empolder/gj/vb/0404/354501.html), not repetitive, Need to ask a question, how to call this in bcb6 MyDLL of PT functions, Each prawn, please reply, wait for,
CodePudding user response:
CodePudding user response:
HINSTANCE hDLL;//handle to the DLL Typedef int __stdcall DLLFUN (*) (int a, int b);
DLLFUN Dll_clFun;
//read: If (hDLL==NULL) HDLL=LoadLibrary ((LPCTSTR) "TestDLL. DLL"); If (hDLL) { Dll_clFun=(DLLFUN) GetProcAddress call (hDLL, "clFun"); } The else { ShowMessage (" load the DLL failed, program exits "); }
//release: If (hDLL) { FreeLibrary (hDLL);//to unload the DLL HDLL=NULL; }