Dav*_*vid 5 c winapi gcc comctl32
我无法使用GCC(MinGW)将Comctl32.lib链接到我的程序.
GCC输入:
gcc -o program.exe main.c images.o -lgdi32 -lcomctl32 -mwindows
Run Code Online (Sandbox Code Playgroud)
GCC输出
main.c: In function 'WinMain':
main.c:120:2: error: unknown type name 'INITCOMMONCONTROLSEX'
main.c:124:9: error: request for member 'dwICC' in something not a structure or union
Run Code Online (Sandbox Code Playgroud)
main.c中的相关代码
#define _WIN32_WINNT _WIN32_WINNT_WIN7
#include <windows.h>
#include <commctrl.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmd)
{
Line 120: INITCOMMONCONTROLSEX icex;
Line 124: icex.dwICC = ICC_LISTVIEW_CLASSES;
InitCommonControlsEx(&icex);
}
Run Code Online (Sandbox Code Playgroud)
感谢您提供的任何帮助或信息.我已经这么久了,只是无法得出答案.
感谢 David H,我已经解决了这个问题。我必须定义
#define _WIN32_IE 0x0900
Run Code Online (Sandbox Code Playgroud)
我的印象是 commctrl.h 默认定义 0x0500(我的函数需要 0x0300),但看起来并非如此。
如果您的项目中没有定义_WIN32_IE宏,则它会自动定义为0x0500。- MSDN 来源
| 归档时间: |
|
| 查看次数: |
1745 次 |
| 最近记录: |