#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(NULL, "Goodbye, cruel world!", "Note", MB_OK);
return 0;
}
运行结果:
WinMain()是Windows中与DOS或UNIX的main()的等价物.这是程序开始执行的入口.参数如下:
HINSTANCE hInstance
程序可执行模块的句柄(內存中的.exe文件).
HINSTANCE hPrevInstance
在Win32程序中总是为NULL.
LPSTR lpCmdLine
命令行参数组成的一个单字符串.不包括程序名字.
int nCmdShow
一个将要传递给ShowWindow()的整数。