代码很短,主要是想学习下VC2005基本使用方法:
#include <windows.h>
LRESULT CALLBACK wndproc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hinstance,HINSTANCE hpre,LPSTR lpcmd,int showcmd)
{
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
RtlZeroMemory(&wndclass,sizeof wndclass);
wndclass.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndclass.lpszClassName="my class";
wndclass.style=CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc=wndproc;
wndclass.hInstance=hinstance;
RegisterClass(&wndclass);
hwnd=CreateWindowEx(WS_EX_OVERLAPPEDWINDOW,classname,"努力学习",WS_OVERLAPPEDWINDOW,200,200,300,300,0,0,hinstance,0);
ShowWindow(hwnd,showcmd);
UpdateWindow(hwnd);
while(GetMessage(&msg,0,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK wndproc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)
{
...代码省略........
}
编译的时候有提示:无法打开包括文件:“windows.h”: No such file or directory
难道在VC2005中不需要windows.h这个头文件??那么应该是什么头文件呢???
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)