#include #include LRESULT CALLBACK chuangkou( HWND hwnd, // handle to window UINT uMsg, // message identifier WPARAM wParam, // first message parameter LPARAM lParam // second message parameter);int WINAPI WinMain( HINSTANCE hIns
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/17 11:32:56
#include #include LRESULT CALLBACK chuangkou( HWND hwnd, // handle to window UINT uMsg, // message identifier WPARAM wParam, // first message parameter LPARAM lParam // second message parameter);int WINAPI WinMain( HINSTANCE hIns
#include
#include
LRESULT CALLBACK chuangkou(
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, // pointer to command line
int nCmdShow // show state of window
)
{
WNDCLASS wndcls;
wndcls.style=CS_HREDRAW|CS_VREDRAW;
wndcls.lpfnWndProc=chuangkou;
wndcls.cbClsExtra=0;
wndcls.cbWndExtra=0;
wndcls.hInstance=hInstance;
wndcls.hIcon=LoadIcon(NULL,IDI_WINLOGO);
wndcls.hCursor=LoadCursor(NULL,IDC_CROSS);
wndcls.hbrBackground=(HBRUSH)GetStockObject(COLOR_WINDOW);
wndcls.lpszMenuName=NULL;
wndcls.lpszClassName="xinjianchuangkou";
RegisterClass(&wndcls);
HWND hwnd;
hwnd=CreateWindow("xinjianchuangkou","chuankou",WS_OVERLAPPEDWINDOW,0,0,500,500,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);
MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK chuangkou(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
switch(uMsg)
{
case WM_CHAR:
char chr[10];
MessageBox(hwnd,chr,"按键",NULL);
break;
case WM_LBUTTONDOWN:
MessageBox(hwnd,"鼠标左键按下","shubiao",NULL);
HDC hdc;
hdc=GetDC(hwnd);
TextOut(hdc,0,50,"有鼠标按下",strlen("有鼠标按下"));
ReleaseDC(hwnd,hdc);
break;
case WM_PAINT:
HDC hDc;
PAINTSTRUCT pa;
hDc=BeginPaint(hwnd,&pa);
TextOut(hDc,0,80,"已经重新绘图",strlen("已经重新绘图"));
EndPaint(hwnd,&pa);
break;
case WM_CLOSE:
if(IDYES==MessageBox(hwnd,"是否要退出程序?","退出",MB_YESNO))
{
DestroyWindow(hwnd);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
break;
}
return 0;
}
出来一大串no matching symbolic information found.的字符,我也不知道是哪的问题,请帮忙解决一下.是我程序的问题啊?还是VC安装的问题呢?
怎么样才能解决啊啊~~急!
#include #include LRESULT CALLBACK chuangkou( HWND hwnd, // handle to window UINT uMsg, // message identifier WPARAM wParam, // first message parameter LPARAM lParam // second message parameter);int WINAPI WinMain( HINSTANCE hIns
你是按照win32窗口程序工程建立的吗?问题像是基本的动态库链接不上,是项目属性里链接的配置不对,要是按部就班按照win32窗口建立程序就不会有这些麻烦
把这些代码拷贝一下,然后新建-》工程-》选win32窗口程序,然后在cpp里面把这些代码粘上试试