소스 코드입니당..
#include <windows.h>
#include <string.h>
#include <stdio.h>
#define _CRT_SECURE_NO_WARNINGS
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance
, LPSTR lpszArg, int nCmdShow)
{
HWND hWnd;
MSG msg;
WNDCLASS WndClass;
char szAppName[] = "Hello";
WndClass.style = NULL;
WndClass.lpfnWndProc = WndProc;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hInstance = hInstance;
WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
WndClass.lpszMenuName = NULL;
WndClass.lpszClassName = "Hello";
if (!RegisterClass(&WndClass)) return NULL;
hWnd = CreateWindow(
szAppName,
szAppName,
WS_OVERLAPPEDWINDOW
CW_USEDEFAULT,CW_USEDEFAULT, 700, 480,
NULL,
NULL,
hInstance,
NULL
);
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT mesg,
WPARAM wParam, LPARAM lParam)
{
static HWND hWnd2;
switch (mesg)
{
case WM_CREATE :
hWnd2 = CreateWindow(
"WND2",
"Child",
WS_OVERLAPPEDWINDOW | WS_VISIBLE |
WS_CHILD,
1000, 320, 100, 100,
hWnd,
NULL,
_hInstance,
NULL
);
break;
case WM_DESTROY:
PostQuitMessage(0);
return FALSE;
}
return DefWindowProc(hWnd, mesg, wParam, lParam);
}
![]() |
|