回 帖 发 新 帖 刷新版面

主题:dll调用总是报错

在DLL中一个弹出对话框的函数,总是报错
//DLL中的一个函数
BOOL WINAPI show(HWND hWnd){
    DialogBox(hInst, (LPCTSTR)IDD_OPTION , hWnd, (DLGPROC)Test);
    return TRUE;
}

//程序通过下述方法调用
BOOL WINAPI DoDockSetDialog(HWND hWnd){
    typedef BOOL(*SHOW)(HWND);
    SHOW show;
    HINSTANCE hDll=NULL;
    hDll=LoadLibrary("Option.dll");
    show=(SHOW)GetProcAddress(hDll,"show");
    show(hWnd);
    FreeLibrary(hDll);
    return TRUE;
}

错误为
  The value of ESP was not properly saved across a function call . This is usually a result of calling a function declared  with one calling convention with a function pointer declared with a different calling convention .
  
不过把传入参数删掉就可以,但我需要一个模态的对话框,请问如何解决?

回复列表 (共1个回复)

沙发

typedef BOOL (WINAPI SHOW)(HWND);

表忘了调用方式

我来回复

您尚未登录,请登录后再回复。点此登录或注册