0
votes

I got some errors in a c++ Dll, can you help me to solve it? The errors are the following:

First error

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

TRANSLATON

function called without arguments list, use Zfx3DDental::Graphic_Dlg_Dll' in order to create a pointer to the menber

Second error

IntelliSense: l'argomento di tipo "LRESULT (__stdcall Zfx3DDental::*)(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)" รจ incompatibile con il parametro di tipo "DLGPROC"

TRANSLATON

the argument of type ... is incompatible with the parameter of type "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);;
}

Header

#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);
....
};

Maybe the problem is the class?

1

1 Answers

0
votes

The problem seems to be that the last parameter to CreateDialog must be a global function, whereas you pass a class method. See this question for more details:

Use class member as WNDPROC/DLGPROC with or without global