本人水平不足,望大神指正!
配置环境:VS2019(Community)+Windows 10
最低配置:VC6+WindowsXP
WinMain:
这个函数是Win32窗口程序的入口点。
原型:
//Unicode
int _stdcall wWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR pCmdLine,
int nCmdShow);
//ANSI(ASCII)
int _stdcall WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
);
MessageBox函数:
函数用于显示一个模态对话框,其中包含一个系统图标、 一组按钮和一个简短的特定于应用程序消息,如状态或错误的信息。
int _stdcall MessageBox(HWND hWnd,//父窗口句柄,可以为NULL
LPCTSTR lpText,//对话框内容
LPCTSTR lpCaption,//对话框标题
UINT uType//对话框类型
);
代码:
#include <Windows.h>
int __stdcall wWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR pCmdLine,
int nCmdShow)
{
MessageBox(NULL,
L"hello world!",
L"我的第一个程序",
MB_OK);
return 0;
}
效果: