我想将对象的指针作为DialogBoxParam()
.
INT_PTR WINAPI DialogBoxParam(
_In_opt_ HINSTANCE hInstance,
_In_ LPCTSTR lpTemplateName,
_In_opt_ HWND hWndParent,
_In_opt_ DLGPROC lpDialogFunc,
_In_ LPARAM dwInitParam
);
这是我的电话DialogBoxParam()
:
MyClass *myObject = new MyClass();
DialogBoxParam(
GetModuleHandle(NULL),
MAKEINTRESOURCE(IDD_SELECT_ETC),
hwnd,
CallbackDlgProc,
(LPARAM)&myObject
);
这是我的尝试之一CallbackDlgProc()
(知道 myFile 是 public char* 成员myObject
):
BOOL CALLBACK CallbackDlgProc(HWND hwndDlg, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
{
MessageBox(NULL, (CHAR*)((*(MyClass*)lParam).myFile), "Title", MB_OK);
return TRUE;
}
case [...]
}
}
知道如何访问和编辑myObject
吗CallbackDlgProc()
?