codeblocks问题

_菜菜 2012-08-11 01:37:30

#define WIN32_LEAN_AND_MEAN

#include <windows.h>
#include <commctrl.h>
#include "resource.h"

HINSTANCE hInst;

BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HWND lsv;
switch(uMsg)
{
case WM_INITDIALOG:
InitCommonControls();
lsv = GetDlgItem(hwndDlg,IDC_LIST1);
ListView_SetExtendedListViewStyle(lsv,LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
return TRUE;


以上,codeblocks是从论坛下的最新版,编译器用的是TDM-GCC,也是下的最新版,但是编译的时候出现如下错误


C:\mingw_listview_test\main.cpp||In function 'BOOL DialogProc(HWND, UINT, WPARAM, LPARAM)':|
C:\mingw_listview_test\main.cpp|17|error: 'LVS_EX_GRIDLINES' was not declared in this scope|
C:\mingw_listview_test\main.cpp|17|error: 'LVS_EX_FULLROWSELECT' was not declared in this scope|
C:\mingw_listview_test\main.cpp|17|error: 'ListView_SetExtendedListViewStyle' was not declared in this scope|
||=== Build finished: 3 errors, 0 warnings (0 minutes, 3 seconds) ===|
这是怎么回事?
...全文
121 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
_菜菜 2012-08-11
  • 打赏
  • 举报
回复
谢谢老邓哈
#define _WIN32_IE 0x0600
#define _WIN32_WINNT 0x0501
#define WINVER 0x0501
我把这些加上就可以了= =
_菜菜 2012-08-11
  • 打赏
  • 举报
回复

#if (_WIN32_WINNT >= 0x501)
#define LVBKIF_FLAG_TILEOFFSET 0x00000100
#define LVBKIF_TYPE_WATERMARK 0x10000000
#endif /* _WIN32_WINNT >= 0x501 */
#define LVS_OWNERDATA 4096
#define LVS_EX_CHECKBOXES 4
#define LVS_EX_FULLROWSELECT 32
#define LVS_EX_GRIDLINES 1
#define LVS_EX_HEADERDRAGDROP 16
#define LVS_EX_ONECLICKACTIVATE 64
#define LVS_EX_SUBITEMIMAGES 2
#define LVS_EX_TRACKSELECT 8
#define LVS_EX_TWOCLICKACTIVATE 128
#define LVSICF_NOINVALIDATEALL 0x00000001
#define LVSICF_NOSCROLL 0x00000002
#if( _WIN32_IE >= 0x0400 )
#define LVS_EX_FLATSB 0x00000100
#define LVS_EX_REGIONAL 0x00000200
#define LVS_EX_INFOTIP 0x00000400
#define LVS_EX_UNDERLINEHOT 0x00000800
#define LVS_EX_UNDERLINECOLD 0x00001000
#define LVS_EX_MULTIWORKAREAS 0x00002000
#endif /* _WIN32_IE >=0x0400 */

看了一下,没有winver版本要求啊
_菜菜 2012-08-11
  • 打赏
  • 举报
回复
这些东西在哪里定义的?
老邓 2012-08-11
  • 打赏
  • 举报
回复
需要定义WINVER这些东西,版本不够。
查一下头文件:LVS_EX_GRIDLINES 的最低版本需求。

24,855

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧