15,472
社区成员
发帖
与我相关
我的任务
分享
DLL :
h中的声明
_declspec(dllexport) char* GetInputBox();
cpp中函数定义
char al[255];
char * GetInputBox()
{
CString str=Inbox;
strncpy(al,(LPSTR)(LPCTSTR)str,255);
return al;
}
//EXE调用Dll文件
typedef char* (*Dllfun)();
Dllfun GetInputBox;
HINSTANCE hdll;
hdll=LoadLibrary("CMyMessage.dll");
if(hdll==NULL)
{
FreeLibrary(hdll);
}
GetInputBox=(Dllfun)GetProcAddress(hdll,"GetInputBox");
if(GetInputBox==NULL)
{
FreeLibrary(hdll);
}
char *p;
p=(char *)GetInputBox();
StrConn.Format("%s",p);
FreeLibrary(hdll);
AfxMessageBox(StrConn);