标题:求救 !!!!!
只看楼主
lisypro
Rank: 4
等 级:业余侠客
威 望:3
帖 子:695
专家分:216
注 册:2005-9-25
结帖率:33.33%
 问题点数:0 回复次数:0 
求救 !!!!!

//fsdaf
//asdff
#include <windows.h>

BOOL InitWindow(HINSTANCE hInstance, int nCmdShow);

LRESULT CALLBACK WinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
//变量说明
HWND hWnd; //窗口句柄

int API WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.

if ( !InitWindow( hInstance, nCmdShow ) ) return FALSE;
MSG msg;
for (;;)//消息循环1
{
if(msg.message== WM_QUIT) break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}//消息循环1
return msg.wParam;
}

static BOOL initWindow(HINSTANCE hInstance, int nCmdShow )
{
WNDCLASS wc;
wc.style=NULL;
wc.lpfnWndProc=(WNDPROC)WinProc;
wc.cbClsExtra=0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = CreateSolidBrush (RGB(100, 0, 0)); //暗红色的背景
wc.lpszMenuName = NULL;
wc.lpszClassName = "My_Test";
RegisterClass(&wc);//注册窗口
//按所给参数创造窗口
hWnd = CreateWindow("My_Test",
"My first program",
WS_POPUP|WS_MAXIMIZE,0,0,
GetSystemMetrics( SM_CXSCREEN ), //此函数返回屏幕宽度
GetSystemMetrics( SM_CYSCREEN ), //此函数返回屏幕高度
NULL,NULL,hInstance,NULL);

if( !hWnd ) return FALSE;
ShowWindow(hWnd,nCmdShow);//显示窗口
UpdateWindow(hWnd);//刷新窗口
return TRUE;
}//end initWindows


LRESULT CALLBACK WinProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
switch( message )
{
case WM_KEYDOWN://击键消息
switch( wParam )
{
case VK_ESCAPE:
MessageBox(hWnd,"ESC键按下了! 确定后退出!","Keyboard",MB_OK);
PostMessage(hWnd, WM_CLOSE, 0, 0);//给窗口发送WM_CLOSE消息
break;
}
return 0; //处理完一个消息后返回0
case WM_CLOSE: //准备退出
DestroyWindow( hWnd ); //释放窗口
return 0;
case WM_RBUTTONDOWN:
MessageBox(hWnd,"鼠标右键按下了!","Mouse",MB_OK);
return 0;
case WM_DESTROY: //如果窗口被人释放…
PostQuitMessage( 0 ); //给窗口发送WM_QUIT消息
return 0;
}
//调用缺省消息处理过程
return DefWindowProc(hWnd,message,wParam,lParam);
}
编译出错提示如下:
--------------------Configuration: dfdf - Win32 Debug--------------------
Compiling...
dfdf.cpp
e:\c\dfdf\dfdf.cpp(84) : fatal error C1010: unexpected end of file while looking for precompiled header directive
执行 cl.exe 时出错.

dfdf.exe - 1 error(s), 0 warning(s)

搜索更多相关主题的帖子: message include asdff fsdaf 
2005-10-30 14:32



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-31932-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.051826 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved