看了一下深入浅出MFC,在BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)中加一段代码就OK了,但现在必须注销加载图标的那句,结果图标显示不对了 LPCSTR className = NULL; if (className==NULL) { // One-time class registration // The only purpose is to make the class name something // meaningful instead of "Afx:0x4d:27:32:hup1hup:hike!"
if (className==NULL)
{
// One-time class registration
// The only purpose is to make the class name something
// meaningful instead of "Afx:0x4d:27:32:hup1hup:hike!"
WNDCLASS wndcls;
::GetClassInfo(AfxGetInstanceHandle(), cs.lpszClass, &wndcls);
wndcls.lpszClassName = "112333333333";
//wndcls.hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
VERIFY(AfxRegisterClass(&wndcls));
className="112333333333";
}
cs.lpszClass = className;
UINT nClassStyle,
HCURSOR hCursor = 0,
HBRUSH hbrBackground = 0,
HICON hIcon = 0
); AfxRegisterWndClass; 返回得到的注册窗口类的类名
反正不固定,不知道这是因为什么?