第一个Windows编程项目

版权声明:转载请注明出处: https://blog.csdn.net/qq_33757398/article/details/82262227

1.基本步骤

1)像正常控制台程序一样建立项目

2)包含"windows.h"头文件

3)主函数:

WinMain (
    _In_ HINSTANCE hInstance,
    _In_opt_ HINSTANCE hPrevInstance,
    _In_ LPSTR lpCmdLine,
    _In_ int nShowCmd
    );

2.简单实例

#include <windows.h>

int WINAPI WinMain(
	HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPSTR lpCmdLine,
	int nShowCmd)
{
	MessageBox(NULL, TEXT("Hello Windows!"), TEXT("Title"), MB_OK);

	return 0;
}

运行结果:

猜你喜欢

转载自blog.csdn.net/qq_33757398/article/details/82262227