/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.
请问高手怎么解决?

解决方案 »

  1.   

    #include <Commctrl.h> 加错地方了,你的CreateStatusWindow写在testris.cpp中,#include <Commctrl.h>应该也加在这个文件中
      

  2.   

    wltg2001你好,你说的很对。分是给你了,但我还想问一下,就上面的程序我把comctl32.lib加入到project-setting-link-object/library  modules中整个程序通过,而加入Commctrl.lib就不行呢?comctl32.lib和Commctrl.lib有什么区别吗?
      

  3.   

    Commctrl.lib?没见过这个库啊!我只用过comctl32.lib这个库!
      

  4.   

    那就是32位系统的,现在都大部分都是32位的, 好像有64位了吧
    Commctrl.lib即使有,也应该是以前系统用的,你用的系统应该不会低于2000吧
      

  5.   

    刚才查了一下,Win32下好像没有Commctrl.lib这个库啊,好像PPC和SP下有这个库