有创意的c语言项目,一个有趣的小程序

  • Post author:
  • Post category:小程序


该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

源码:

#include

#include

#include

#include

#include

HINSTANCE g_hInstance = 0;

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain(

HINSTANCE hInstance,

HINSTANCE hPreInstance,

LPSTR lpCmdLine,

int nShowCmd

)

{

g_hInstance = hInstance;

srand((unsigned)time(NULL));

//1.注册窗口类

WNDCLASS wc = { 0 };

wc.lpszClassName = _T(“MyClass”);

wc.lpfnWndProc = WndProc;

wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);

RegisterClass(&wc);

//2.创建窗口

HWND hWnd = CreateWindow(

wc.lpszClassName,

_T(“顽皮的按钮”),

WS_OVERLAPPEDWINDOW,

200, 100,

640, 480,

NULL,

NULL,

g_hInstance,

<