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