CreateWindow() 创建LISTVIEW 报错解决方法
CreateWindow() 创建LISTVIEW 报错
代码:
HWND CreateListView (HWND hWndParent)
{
RECT rcl;
HWND hWndListView=NULL;
GetClientRect (hWndParent, &rcl);
hWndListView = CreateWindow(WC_LISTVIEW,L"MYLISTVIEW",WS_CHILD|LVS_REPORT,0,0,
(rcl.right - rcl.left ),(rcl.bottom - rcl.top ),hWndParent,
(HMENU)ID_LISTVIEW,g_hInst,NULL);
if(hWndListView == NULL)
{
return NULL;
}
UpdateWindow(hWndListView);
return hWndListView;
}
错误提示如下:
error C2143: syntax error:missing ')'before ';'
error C2660: 'CreateWindowExW':function does not take 10 arguments
error C2143: syntax error: missing ';'before ','
error C2059: syntax error:')'
就是CreateWindow,找了很就也不知道为什么
------解决方案--------------------
去掉(HMENU)呢
------解决方案--------------------
我奇怪的是你的错误为什么指向CreateWindowExW
你并没有使用这个函数啊
------解决方案--------------------
可能是define ID_LISTVIEW 末尾多了个分号;
------解决方案--------------------
代码:
HWND CreateListView (HWND hWndParent)
{
RECT rcl;
HWND hWndListView=NULL;
GetClientRect (hWndParent, &rcl);
hWndListView = CreateWindow(WC_LISTVIEW,L"MYLISTVIEW",WS_CHILD|LVS_REPORT,0,0,
(rcl.right - rcl.left ),(rcl.bottom - rcl.top ),hWndParent,
(HMENU)ID_LISTVIEW,g_hInst,NULL);
if(hWndListView == NULL)
{
return NULL;
}
UpdateWindow(hWndListView);
return hWndListView;
}
错误提示如下:
error C2143: syntax error:missing ')'before ';'
error C2660: 'CreateWindowExW':function does not take 10 arguments
error C2143: syntax error: missing ';'before ','
error C2059: syntax error:')'
就是CreateWindow,找了很就也不知道为什么
------解决方案--------------------
去掉(HMENU)呢
------解决方案--------------------
我奇怪的是你的错误为什么指向CreateWindowExW
你并没有使用这个函数啊
------解决方案--------------------
可能是define ID_LISTVIEW 末尾多了个分号;
------解决方案--------------------