0
我试图在我的窗口上放一个简单的超链接。InitCommonControlsEx()在Windows 8.1中ICC_LINK_CLASS失败
INITCOMMONCONTROLSEX iccx;
iccx.dwSize = sizeof(INITCOMMONCONTROLSEX);
iccx.dwICC = ICC_LINK_CLASS; // CommCtrl.h: #define ICC_LINK_CLASS 0x00008000
bool bResult = InitCommonControlsEx(&iccx); // bResult is false.
DWORD dwError = GetLastError(); // dwError is 0.
hWnd = CreateWindowExW(/*_In_ DWORD*/ 0,
/*_In_opt_ LPCTSTR*/ WC_LINK, // CommCtrl.h: #define WC_LINK L"SysLink"
/*_In_opt_ LPCTSTR*/ L"Hello World",
/*_In_ DWORD*/ WS_VISIBLE | WS_CHILD | WS_TABSTOP,
/*_In_ int*/ 50,
/*_In_ int*/ 200,
/*_In_ int*/ 100,
/*_In_ int*/ 20,
/*_In_opt_ HWND*/ hWndParent,
/*_In_opt_ HMENU*/ NULL,
/*_In_opt_ HINSTANCE*/ hInstance,
/*_In_opt_ LPVOID*/ NULL);
DWORD dwError = GetLastError(); // hWnd is NULL and dwError is 1407.
错误代码1407在here中说明如下。
ERROR_CANNOT_FIND_WND_CLASS
1407 (0x57F)
Cannot find window class.
我使用的是Windows 8.1 Pro x64,并且我从未在任何其他版本的Windows上尝试过这些代码。
这里有什么问题?
您忘记了共同控制6清单吗? SysLink控件需要公共控件6. – andlabs
@andlabs第一次听到它。我现在将谷歌它。谢谢。 – hkBattousai
经过一番网络调查,我能够通过添加代码#pragma comment(linker,/ manifestdependency:\“type ='win32'name ='Microsoft.Windows.Common-Controls'version =' 6.0.0.0'processorArchitecture ='*'publicKeyToken ='6595b64144ccf1df'language ='*'\“”)''在包含CommCtrl.h'#include'之后。然而,我不知道我做了什么的解释。 –
hkBattousai