首页 > 编程知识 正文

简单有趣的c语言程序代码,C语言有趣程序

时间:2023-05-05 02:55:18 阅读:248133 作者:4534

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

#include

#include

#include

#include

#include

HINSTANCE g_hInstance = 0;

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

int WINAPI WinMain(

HINSTANCE hPreInstance,

int nShowCmd

)

{

g_hInstance = hInstance;

srand((unsigned)time(NULL));

//1.注册窗口类

WNDCLASS wc = { 0 };

wc.lpszClassName = gxdmb("MyClass");

wc.lpfnWndProc = WndProc;

wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);

RegisterClass(&wc);

//2.创建窗口

wc.lpszClassName,

gxdmb("顽皮的按钮"),

WS_OVERLAPPEDWINDOW,

200, 100,

640, 480,

NULL,

NULL,

g_hInstance,

0

);

//3.更新显示窗口

//4.消息循环

MSG Msg = { 0 };

while (GetMessage(&Msg, 0, 0, 0))

{

TranslateMessage(&Msg);

DispatchMessage(&Msg);

}

return (int)Msg.lParam;

}

LRESULT CALLBACK WndProc(HWND hWnd, gxdzfj, yxdhs, LPARAM lParam)

{

static int nCnt = 0;

switch (uMsg)

{

case WM_CREATE:

{

gxdmb("button"),

gxdmb("来点我"),

WS_CHILD | WS_VISIBLE,

10, 10,

80, 45,

hWnd,

g_hInstance,

0

);

}break;

case WM_COMMAND:

{

if (nId == 0x1000 && nCode == BN_CLICKED)

{

if (nCnt == 10)

{

PostMessage(hWnd, WM_CLOSE, 0, 0);

}

int x = rand() % 520;

int y = rand() % 390;

nCnt++;

}

}break;

case WM_CLOSE:

break;

}

}

见缝插针游戏的实现途径执行Struts2的流程是什么

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。