您的位置:首页 > 其它

GetIconWndClass注册窗口类

2015-11-03 14:30 609 查看
GetIconWndClass()

得到的窗口类名:Afx:400000:b:10003:6:141ebb

并且每次都不一样。

\Microsoft Visual Studio 8\VC\atlmfc\src\mfc\winfrm.cpp

LPCTSTR CFrameWnd::GetIconWndClass(DWORD dwDefaultStyle, UINT nIDResource)

{

ASSERT_VALID_IDR(nIDResource);

HINSTANCE hInst = AfxFindResourceHandle(

ATL_MAKEINTRESOURCE(nIDResource), ATL_RT_GROUP_ICON);

HICON hIcon = ::LoadIcon(hInst, ATL_MAKEINTRESOURCE(nIDResource));

if (hIcon != NULL)

{

CREATESTRUCT cs;

memset(&cs, 0, sizeof(CREATESTRUCT));

cs.style = dwDefaultStyle;

PreCreateWindow(cs);

// will fill lpszClassName with default WNDCLASS name

// ignore instance handle from PreCreateWindow.

WNDCLASS wndcls;

if (cs.lpszClass != NULL &&

AfxCtxGetClassInfo(AfxGetInstanceHandle(), cs.lpszClass, &wndcls) &&

wndcls.hIcon != hIcon)

{

// register a very similar WNDCLASS

return AfxRegisterWndClass(wndcls.style,

wndcls.hCursor, wndcls.hbrBackground, hIcon);

}

}

return NULL; // just use the default

}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: