#include <windows.h>
// 定义控件ID
#define ID_BTN_HELLO 1001
#define ID_BTN_BAD 1002
// 窗口过程函数
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch (uMsg) {
case WM_CREATE: {
// 创建“你好”按钮
CreateWindow(
"BUTTON", "你好",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
50, 50, 100, 30,
hwnd, (HMENU)ID_BTN_HELLO, NULL, NULL
);
}
// 入口函数
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
const char CLASS_NAME[] = "SimpleButtonApp";
}