win32 프로그래밍 알려주실분 힝 [1]

병장 멘탈 머슬 훈련 | 21-09-11 21:14:35 | 조회 : 528 | 추천 : -


자식 윈도우로 태어나게 만드는거 연습중인데 왜 안될까여 ㅠㅠ 

소스 코드입니당..

 

#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);

}


SNS로 공유하기
< 1 2 3 4 5 >