#include <windows.h>
LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam );
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
PSTR lpCmdLine, // command line
int nCmdShow // show state
)
{
static TCHAR AppName[] = TEXT("HelloWin");
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
wndclass.style=CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc=WndProc;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hInstance=hInstance;
wndclass.hIcon=LoadIcon(NULL,IDI_ERROR);
wndclass.hCursor=LoadCursor(NULL,IDC_CROSS);
wndclass.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndclass.lpszMenuName=NULL;
wndclass.lpszClassName=AppName;
if(!RegisterClass(&wndclass))
{
MessageBox(NULL,TEXT("This porgram must run NT!"),AppName,MB_OK);
return 0;
}
hwnd=CreateWindow(
AppName, // registered class name
TEXT("HELLOWIN"), // window name
WS_OVERLAPPEDWINDOW, // window style
500, // horizontal position of window
500, // vertical position of window
500, // window width
500, // window height
NULL, // handle to parent or owner window
NULL, // menu handle or child identifier
hInstance, // handle to application instance
NULL // window-creation data
);
ShowWindow(hwnd,SW_SHOW);
UpdateWindow(hwnd);
while ( GetMessage(&msg,hwnd,0,0)>0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam )
{
PAINTSTRUCT ps;
HDC hdc;
RECT rect;
switch(uMsg)
{
case WM_CREATE:
return 0;
case WM_PAINT:
hdc=BeginPaint(hwnd,&ps);
GetClientRect(hwnd,&rect);
DrawText(hdc,TEXT("Hello Window XP!"),-1,&rect,DT_CENTER|DT_SINGLELINE|DT_VCENTER);
EndPaint(hwnd,&ps);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
1.HelloWin.rar (16个子文件)
HelloWin
HelloWin.ncb 41KB
HelloWin.opt 53KB
HelloWin.dsp 4KB
HelloWin.plg 1KB
Debug
vc60.pdb 76KB
HelloWin.exe 168KB
HelloWin.pdb 433KB
vc60.idb 129KB
HelloWin.ilk 191KB
HelloWin.pch 4.25MB
HelloWin.obj 14KB
HelloWin.sbr 0B
HelloWin.bsc 1.83MB
HelloWin.cpp 2KB
HelloWin.dsw 522B
录像1.exe 205.66MB
共 16 条
- 1
资源评论
- qazwww9872013-06-23这教程不错值得下载
lukarl592
- 粉丝: 6
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功