CreateStatusWindow' : undeclared identifier

smartgyf 2010-01-16 06:51:10
/game.cpp/#include <windows.h>
#include "game.h"
#include "resource.h"
#include <Commctrl.h>
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
)
{
InitCommonControls();
.....................
}

LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
switch(uMsg)
{
case WM_CREATE:
GameUI(hwnd);
break;
case WM_PAINT:
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}

/game.h/
void GameUI(HWND hwnd);

/tetris.cpp/
#include<windows.h>
HWND hstatus;
void GameUI(HWND hwnd)
{
hstatus=CreateStatusWindow(WS_CHILD | WS_VISIBLE,NULL,hwnd,1);
}
我编译了好几次,提示就是这样:error C2065: 'CreateStatusWindow' : undeclared identifier
error C2440: '=' : cannot convert from 'int' to 'struct HWND__ *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
请问高手怎么解决?
...全文
100 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
wltg2001 2010-01-16
  • 打赏
  • 举报
回复
刚才查了一下,Win32下好像没有Commctrl.lib这个库啊,好像PPC和SP下有这个库
hzy694358 2010-01-16
  • 打赏
  • 举报
回复
那就是32位系统的,现在都大部分都是32位的, 好像有64位了吧
Commctrl.lib即使有,也应该是以前系统用的,你用的系统应该不会低于2000吧
wltg2001 2010-01-16
  • 打赏
  • 举报
回复
Commctrl.lib?没见过这个库啊!我只用过comctl32.lib这个库!
smartgyf 2010-01-16
  • 打赏
  • 举报
回复
wltg2001你好,你说的很对。分是给你了,但我还想问一下,就上面的程序我把comctl32.lib加入到project-setting-link-object/library modules中整个程序通过,而加入Commctrl.lib就不行呢?comctl32.lib和Commctrl.lib有什么区别吗?
sjdev 2010-01-16
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 wltg2001 的回复:]
#include <Commctrl.h> 加错地方了,你的CreateStatusWindow写在testris.cpp中,#include <Commctrl.h>应该也加在这个文件中
[/Quote]

汗,我竟没仔细看原帖内容。
wltg2001 2010-01-16
  • 打赏
  • 举报
回复
#include <Commctrl.h> 加错地方了,你的CreateStatusWindow写在testris.cpp中,#include <Commctrl.h>应该也加在这个文件中
sjdev 2010-01-16
  • 打赏
  • 举报
回复
#include <commctrl.h>

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

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