请问 UICtrlWndProc 要访问类成员变量 应该如何改?
慕容飞 2005-06-12 12:36:52 class CtrlUI{
private:
HWND hwndUI;
char szClassName[10];
HINSTANCE hInstD;
CTRLPM cpm;
LRESULT CALLBACK UICtrlWndProc(HWND hwnd,UINT msg,
WPARAM wParam,LPARAM lParam)
{
return DefWindowProc(hwnd,msg,wParam,lParam);
}
public:
CtrlUI(void)
{
}
~CtrlUI(void)
{
}
HWND CreateUI(HWND hWndParent=NULL,HINSTANCE hInst=NULL,int xPos=0,
int yPos=0,int width=300,int height=120)
{
WNDCLASSEX wcWndCls;
wcWndCls.cbSize = sizeof(WNDCLASSEX);
wcWndCls.cbClsExtra = 0;
wcWndCls.cbWndExtra = sizeof(DWORD) * 8;
wcWndCls.hIcon = NULL;
wcWndCls.hInstance = hInst;
wcWndCls.hCursor = LoadCursor(NULL,IDC_ARROW);
wcWndCls.hbrBackground = (HBRUSH)COLOR_WINDOW;
wcWndCls.lpszMenuName = (LPTSTR)NULL;
wcWndCls.hIconSm = wcWndCls.hIcon;
wcWndCls.style = CS_HREDRAW|CS_VREDRAW;
wcWndCls.lpfnWndProc = UICtrlWndProc;
wcWndCls.lpszClassName = (LPTSTR)szClassName;
RegisterClassEx(&wcWndCls);
}
编译出错如下,改成 static LRESULT CALLBACK UICtrlWndProc(...) 又不能访问类成员变量
--------------------Configuration: wb - Win32 Debug--------------------
Compiling...
wb.cpp
d:\s\wb\ui.h(253) : error C2440: '=' : cannot convert from 'long (__stdcall CtrlUI::*)(struct HWND__ *,unsigned int,unsigned int,long)' to 'long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)'
There is no context in which this conversion is possible
Error executing cl.exe.
wb.exe - 1 error(s), 0 warning(s)
请问 UICtrlWndProc 要访问类成员变量 应该如何改?