c ++ dll CreateDialog错误

时间:2014-05-28 10:19:52

标签: c++ dll callback dialog

我在c ++ Dll中遇到了一些错误,你能帮我解决一下吗? 错误如下:

第一个错误

  

错误C3867:'& Zfx3DDental :: Graphic_Dlg_Dll':chiamata di funzione senza elenco di argomenti; utilizzare'Zfx3DDental :: Graphic_Dlg_Dll'per creare un puntatore al membro

TRANSLATON

  

函数调用无参数列表,使用Zfx3DDental :: Graphic_Dlg_Dll'以创建指向menber的指针

第二个错误

  

IntelliSense:l'argomento di tipo“LRESULT(__stdcall Zfx3DDental :: *)(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam)”èincompompatibilecon il parametro di tipo“DLGPROC”

TRANSLATON

  

类型...的参数与“DLGPROC”

类型的参数不兼容

CODE(file.cpp)

void ZFX3DDENTALDLL Zfx3DDental::GraphicShow_Dll(HWND hWnd)
{   
winHwnd = CreateDialog(hinst, MAKEINTRESOURCE(IDD_FORMVIEW), hWnd, Graphic_Dlg_Dll); //Here I got the error!!!
if (winHwnd == NULL)
{
    MessageBox(hWnd, TEXT("Error"), TEXT("Error"), MB_OK);
}
InitIstance(winHwnd);
ShowWindow(winHwnd, SW_SHOW);
DWORD d = GetLastError();
}

LRESULT CALLBACK Zfx3DDental::Graphic_Dlg_Dll(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
....
return DefWindowProc(hDlg, msg, wParam, lParam);;
}

标题

#define ZFX3DDENTALDLL __declspec(dllexport)
#define ZFX3D_ID long

class Zfx3DDental
{
....
public:
Zfx3DDental();
~Zfx3DDental();

void ZFX3DDENTALDLL GraphicShow_Dll(HWND hWnd);
    ....
private:
LRESULT   CALLBACK Graphic_Dlg_Dll(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
....
};

也许问题是班级?

1 个答案:

答案 0 :(得分:0)

问题似乎是CreateDialog的最后一个参数必须是一个全局函数,而你传递一个类方法。有关详细信息,请参阅此问题:

Use class member as WNDPROC/DLGPROC with or without global