๐Ÿ“˜ Windows ํ”„๋กœ๊ทธ๋ž˜๋ฐ

ํŒŒ์ธยท2022๋…„ 1์›” 31์ผ
0

Windows Programming

๋ชฉ๋ก ๋ณด๊ธฐ
1/3
post-thumbnail
post-custom-banner

https://docs.microsoft.com/en-us/windows/win32/learnwin32/learn-to-program-for-windows

์œ„ ๋‚ด์šฉ์„ ์ฐธ๊ณ ํ•˜์—ฌ ์ •๋ฆฌํ•œ ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค.



๐Ÿ“ Windows Coding Conventions

๐Ÿ“Œ Typedefs

Integer types

๋ฐ์ดํ„ฐ ํ˜•์‹ํฌ๊ธฐ
BYTE8๋น„ํŠธ
DWORD32๋น„ํŠธ
INT3232๋น„ํŠธ
INT6464๋น„ํŠธ
LONG32๋น„ํŠธ
LONGLONG64๋น„ํŠธ
UINT3232๋น„ํŠธ
UINT6464๋น„ํŠธ
ULONG32๋น„ํŠธ
ULONGLONG64๋น„ํŠธ
WORD16๋น„ํŠธ

Boolean Type

WinDef.h์—๋Š” BOOL๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉ๋˜๋Š” ๋‘๊ฐ€์ง€ ๊ฐ’์ด ์ •์˜๋˜์–ด ์žˆ๋‹ค.

#define FALSE 0
#define TRUE 1

๊ทธ๋Ÿฌ๋‚˜ BOOL ํ˜•์‹์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ๋Œ€๋ถ€๋ถ„์˜ ํ•จ์ˆ˜๋Š” ์ฐธ์ผ ๊ฒฝ์šฐ 0์€ ์•„๋‹ˆ์ง€๋งŒ 1๋„ ์•„๋‹Œ ๊ฐ’์ด ๋ฐ˜ํ™˜๋  ์ˆ˜ ์žˆ๋‹ค.

๋”ฐ๋ผ์„œ ์•„๋ž˜์ฒ˜๋Ÿผ ์ž‘์„ฑํ•˜๋ฉด ์•ˆ๋œ๋‹ค.

if (result == TRUE) // wrong !!
{
  ...
}

์•„๋ž˜๋Š” ๋งž๋Š” ํ‘œํ˜„๋“ค์ด๋‹ค.

if (SomeFunctionThatReturnsBoolean())
{
  ...
}

// or

if (SomeFunctionThatReturnsBoolean() != FALSE)
{
  ...
}

Pointer Types

Windows์—์„œ ํฌ์ธํ„ฐ๋Š” ์ผ๋ฐ˜์ ์œผ๋กœ ์ด๋ฆ„ ์•ž์— P๋‚˜ LP๋ฅผ ๋ถ™์—ฌ์„œ ํ‘œํ˜„ํ•œ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด LPRECT๋Š” RECT์— ๋Œ€ํ•œ ํฌ์ธํ„ฐ์ด๋‹ค.

RECT๊ฐ€ ์‚ฌ๊ฐํ˜•์„ ์„ค๋ช…ํ•˜๋Š” ๊ตฌ์กฐ์ฒด๋ผ๊ณ  ํ•  ๋•Œ RECT์˜ ํฌ์ธํ„ฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

RECT* rect; // Pointer to a RECT structure
LPRECT rect; // The same 
PRECT rect; // Also the same

P๋Š” ํฌ์ธํ„ฐ์ด๊ณ , LP๋Š” long ํฌ์ธํ„ฐ๋ฅผ ์˜๋ฏธํ•œ๋‹ค. LP๋Š” 16๋น„ํŠธ ์ฝ”๋“œ๋ฅผ 32๋น„ํŠธ Windows์— ์“ธ ๋•Œ ์œ ์šฉํ•˜๊ฒŒ ์‚ฌ์šฉ๋˜์—ˆ์œผ๋‚˜ ํ˜„์žฌ๋Š” P์™€ LP๋Š” ๊ตฌ๋ถ„๋˜์ง€ ์•Š์œผ๋ฉฐ ๋™์ผํ•˜๊ฒŒ ์“ฐ์ธ๋‹ค. ํฌ์ธํ„ฐ๋ฅผ ๋‚˜ํƒ€๋‚ผ ๋•Œ ๋ณดํ†ต์€ P๋ฅผ ์“ด๋‹ค.


Pointer Precision Types

  • DWORD_PTR
  • INT_PTR
  • LONG_PTR
  • ULONG_PTR
  • UINT_PTR

์œ„ ํฌ์ธํ„ฐ ์ •๋ฐ€๋„ ํƒ€์ž…๋“ค์€ 32๋น„ํŠธ, 64๋น„ํŠธ ๋“ฑ์˜ ํ™˜๊ฒฝ์— ๋งž๊ฒŒ ์ •์˜๋˜์–ด ์žˆ๋‹ค. ์ฆ‰ 32๋น„ํŠธ์—์„œ๋Š” 32๋น„ํŠธ ํฌ์ธํ„ฐ, 64๋น„ํŠธ์—์„œ๋Š” 64๋น„ํŠธ ํฌ์ธํ„ฐ๊ฐ€ ๋œ๋‹ค.

๋”ฐ๋ผ์„œ ์ด๋Ÿฌํ•œ ํ˜•์‹์€ ์ •์ˆ˜๋ฅผ ํฌ์ธํ„ฐ๋กœ ์บ์ŠคํŒ…ํ•˜๋Š” ์ƒํ™ฉ์—์„œ ์‚ฌ์šฉ๋œ๋‹ค. ํฌ์ธํ„ฐ ์‚ฐ์ˆ ์ด๋‚˜, ๋ฃจํ”„๋กœ ์ „์ฒด ๋ฐ”์ดํŠธ ๋ฒ”์œ„๋ฅผ ๋ฐ˜๋ณตํ•  ๋•Œ ๋“ฑ์—์„œ๋„ ์‚ฌ์šฉ๋œ๋‹ค. ๋˜ 32๋น„ํŠธ์—์„œ 64๋น„ํŠธ๋กœ ํ™•์žฅํ•˜๋Š” ๊ฒฝ์šฐ๋„ ๊ฐ€๋Šฅํ•˜๋‹ค. ์ด ๊ฒฝ์šฐ์—๋Š” ํฌ์ธํ„ฐ์˜ ํฌ๊ธฐ๋Š” ์—ฌ์ „ํžˆ 4byte์ด๋‹ค.




๐Ÿ“ Working with Strings

Windows๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ UTF-16 ์ธ์ฝ”๋”ฉ์„ ์‚ฌ์šฉํ•˜์—ฌ ์œ ๋‹ˆ์ฝ”๋“œ ๋ฌธ์ž๋ฅผ ๋‚˜ํƒ€๋‚ด์–ด ๊ฐ ๋ฌธ์ž๋Š” 16๋น„ํŠธ๋กœ ์ธ์ฝ”๋”ฉ๋œ๋‹ค.
UTF-8 ๋ฌธ์ž๋ฅผ 8๋น„ํŠธ ANSI ๋ฌธ์ž์™€ ๊ตฌ๋ณ„ํ•˜๊ธฐ ์œ„ํ•ด wide ๋ฌธ์ž๋ผ๊ณ  ๋ถ€๋ฅธ๋‹ค.

  • ASCII : 1960๋…„๋Œ€ ๋ฏธ๊ตญ์—์„œ ์ •์˜ํ•œ ํ‘œ์ค€ํ™”ํ•œ ๋ถ€ํ˜ธ์ฒด๊ณ„
  • ANSI : 8๋น„ํŠธ๋กœ ํ™•์žฅํ•œ ASCII ์ฝ”๋“œ
  • UNICODE : ANSI๋กœ๋Š” ํ•œ๊ตญ, ์ค‘๊ตญ, ์ผ๋ณธ๊ณผ ๊ฐ™์€ ๋ฌธ์ž ํ‘œํ˜„์— ํ•œ๊ณ„๊ฐ€ ์žˆ์–ด ์šฉ๋Ÿ‰์„ ํฌ๊ฒŒ ํ™•์žฅํ•œ 2๋ฐ”์ดํŠธ ๊ธฐ๋ฐ˜์˜ ์ฝ”๋“œ
  • UTF-8 : ์œ ๋‹ˆ์ฝ”๋“œ๋ฅผ 8๋น„ํŠธ ์ˆซ์ž์˜ ์ง‘ํ•ฉ์œผ๋กœ ๋‚˜ํƒ€๋‚ธ ๊ฒƒ

Visual C++ ์ปดํŒŒ์ผ๋Ÿฌ๋Š” wide ๋ฌธ์ž์— ๋Œ€ํ•ด wchar_t๋ฅผ ์ง€์›ํ•˜๋ฉฐ WinNT(ํ—ค๋”ํŒŒ์ผ)์—๋Š” ์•„๋ž˜ typedef๊ฐ€ ์ •์˜๋˜์–ด ์žˆ๋‹ค.

typedef wchar_t WCHAR;

wide ๋ฌธ์ž, ๋ฌธ์ž์—ด์„ ์ž‘์„ฑํ•˜๋ ค๋ฉด ์•ž์— L์„ ๋ถ™์ด๋ฉด ๋œ๋‹ค.

wchar_t a = L'a';
wchar_t *str = L"hello";

๋ฌธ์ž์—ด ๊ด€๋ จ typedef๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค

TypedefDefinition
CHARchar
PSTR or LPSTRchar*
PCSTR or LPCSTRconst char*
PWSTR or LPWSTRwchar_t*
PCWSTR or LPCWSTRconst wchar_t*

๐Ÿ“Œ Unicode and ANSI Functions

Windows์— ๋Œ€ํ•œ ์œ ๋‹ˆ์ฝ”๋“œ ์ง€์›์„ ๋„์ž…ํ•˜๋Š” ๊ฒฝ์šฐ ๋‘ ๊ฐœ์˜ ๋ณ‘๋ ฌ API๋ฅผ ์ด์šฉํ•œ๋‹ค. (ANSI ๋ฌธ์ž์—ด๊ณผ ์œ ๋‹ˆ์ฝ”๋“œ ๋ฌธ์ž์—ด ์šฉ)

๐Ÿ”Ž ์ฐฝ ์ œ๋ชฉ ํ‘œ์‹œ์ค„์˜ ํ…์ŠคํŠธ๋ฅผ ์„ค์ •ํ•˜๋Š” ๋‘ ๊ฐ€์ง€ ํ•จ์ˆ˜

  • Setwindowtexta : ANSI ๋ฌธ์ž์—ด ์‚ฌ์šฉ
  • Setwindowtextw : ์œ ๋‹ˆ์ฝ”๋“œ ๋ฌธ์ž์—ด ์‚ฌ์šฉ

๋‚ด๋ถ€์ ์œผ๋กœ ANSI ๋ฒ„์ „์€ ๋ฌธ์ž์—ด์„ ์œ ๋‹ˆ์ฝ”๋“œ๋กœ ์ „ํ™˜ํ•œ๋‹ค.

๋˜ํ•œ Windows ํ—ค๋”๋Š” ์•„๋ž˜์™€ ๊ฐ™์€ ๋งคํฌ๋กœ๋ฅผ ์ง€์›ํ•œ๋‹ค.

#ifdef UNICODE
#define SetWindowText SetWindowTextW
#else 
#define SetWindowText SetWindowTextA
#endif

ANSI ๋ฌธ์ž์—ด์€ ํ˜ธํ™˜๋˜์ง€ ์•Š๋Š” ์–ธ์–ด๊ฐ€ ๋งŽ๊ธฐ ๋•Œ๋ฌธ์— ์œ ๋‹ˆ์ฝ”๋“œ ๋ฒ„์ „์„ ์“ฐ๋Š” ๊ฒƒ์ด ์ข‹๋‹ค. Windows์˜ ์ตœ์‹  API์—๋Š” ANSI ๋ฒ„์ „์ด ์—†๊ณ  ์œ ๋‹ˆ์ฝ”๋“œ ๋ฒ„์ „๋งŒ ์žˆ๋‹ค.


๐Ÿ“Œ TCHARs

์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์ด ์—ฌ๋Ÿฌ ์œˆ๋„์šฐ ๋ฒ„์ „์„ ๋ชจ๋‘ ์ง€์›ํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ ๋Œ€์ƒ ํ”Œ๋žซํผ์— ๋”ฐ๋ผ ANSI ๋˜๋Š” ์œ ๋‹ˆ์ฝ”๋“œ ๋ฌธ์ž์—ด์— ๋Œ€ํ•ด ๋™์ผํ•œ ์ฝ”๋“œ๋ฅผ ์ปดํŒŒ์ผ ํ•˜๋Š” ๊ฒƒ์ด ์œ ์šฉํ•˜๋‹ค. ๋”ฐ๋ผ์„œ Windows SDK๋Š” ํ”Œ๋žซํผ์— ๋”ฐ๋ผ ๋ฌธ์ž์—ด์„ ์œ ๋‹ˆ์ฝ”๋“œ๋‚˜ ANSI๋กœ ๋งคํ•‘ํ•˜๋Š” ๋งคํฌ๋กœ๋ฅผ ์žฌ๊ณตํ•œ๋‹ค.

Macro์œ ๋‹ˆ์ฝ”๋“œ(Unicode)ANSI
TCHARwchar_tchar
TEXT("x")L"x""x"

์˜ˆ๋ฅผ ๋“ค์–ด ์•„๋ž˜ ์ฝ”๋“œ๋Š”

SetWindowText(TEXT("My Application"));

๋‘˜ ์ค‘ ํ•˜๋‚˜๊ฐ€ ๋œ๋‹ค.

SetWindowTextW(L"My Application"); // ์œ ๋‹ˆ์ฝ”๋“œ
SetWindowTextA("My Application"); // ANSI

๋ช‡๋ช‡ ํ—ค๋”๋Š” ์ „์ฒ˜๋ฆฌ๊ธฐ ๊ธฐํ˜ธ UNICODE๋ฅผ ์ด์šฉํ•˜๊ณ  ๋‹ค๋ฅธ ๊ฒƒ๋“ค์€ _UNICODE ๋ฅผ ์ด์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋‘˜๋‹ค define ํ•ด์ฃผ์–ด์•ผ ํ•œ๋‹ค.

Visual C++ ์—์„œ๋Š” default๋กœ ์„ค์ •๋œ๋‹ค.




๐Ÿ“ What Is a Window?

์ฐฝ์„ ์ƒ๊ฐํ•˜๋ฉด ๋ณดํ†ต ์œ„์™€ ๊ฐ™์€ ์ฐฝ์„ ๋– ์˜ฌ๋ฆฐ๋‹ค. ์ด๋Ÿฌํ•œ ์ฐฝ์„ application window ๋˜๋Š” main window ๋ผ๊ณ  ํ•œ๋‹ค. ์ผ๋ฐ˜์ ์œผ๋กœ ์ œ๋ชฉ ํ‘œ์‹œ์ค„, ์ตœ์†Œํ™”, ์ตœ๋Œ€ํ™” ๋ฒ„ํŠผ ๋ฐ ๊ธฐํƒ€ ํ‘œ์ค€ UI ์š”์†Œ๊ฐ€ ์žˆ๋Š” ํ”„๋ ˆ์ž„์ด ์žˆ๋‹ค.

ํ”„๋ ˆ์ž„์€ ์šด์˜ ์ฒด์ œ๊ฐ€ ์ฐฝ์˜ ํ•ด๋‹น ์˜์—ญ ๋ถ€๋ถ„์„ ๊ด€๋ฆฌํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋น„ ํด๋ผ์ด์–ธํŠธ ์˜์—ญ (non-client area)๋ผ๊ณ  ๋ถ€๋ฅธ๋‹ค.

ํ”„๋ ˆ์ž„ ๋‚ด์˜ ์˜์—ญ์€ ํด๋ผ์ด์–ธํŠธ ์˜์—ญ(client area)์ด๋‹ค.

๋‹ค๋ฅธ ์œ ํ˜•์˜ ์ฐฝ์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

์ด๋Ÿฌํ•œ ๋ฒ„ํŠผ๊ณผ ๊ฐ™์€ UI control๋„ ์ฐฝ์ด๋‹ค. control๊ณผ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ฐฝ์€ ์„œ๋กœ ํ†ต์‹ ํ•  ์ˆ˜ ์žˆ๋‹ค.

์ฐฝ์„ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ƒ๊ฐํ•˜๋Š” ๊ฒƒ์ด ์ข‹๋‹ค

  • ํ™”๋ฉด์˜ ํŠน์ • ๋ถ€๋ถ„์„ ์ฐจ์ง€ํ•œ๋‹ค.
  • ํŠน์ • ์‹œ์ ์— ํ‘œ์‹œ๋  ์ˆ˜๋„, ํ‘œ์‹œ๋˜์ง€ ์•Š์„ ์ˆ˜๋„ ์žˆ๋‹ค.
  • ์ž์‹ ์„ ๊ทธ๋ฆฌ๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ๊ณ  ์žˆ๋‹ค.
  • ์‚ฌ์šฉ์ž ๋˜๋Š” ์šด์˜ ์ฒด์ œ์˜ ์ด๋ฒคํŠธ์— ์‘๋‹ตํ•œ๋‹ค.

๐Ÿ“Œ Parent Windows and Owner Windows

control ์ฐฝ์€ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ฐฝ์˜ ์ž์‹์ด๋‹ค.
๋˜ modal ๋Œ€ํ™” ์ƒ์ž๊ฐ€ ํ‘œ์‹œ๋  ๋•Œ, ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ฐฝ์€ ์†Œ์œ ์ž(owner)์ฐฝ์ด๊ณ  ๋Œ€ํ™” ์ƒ์ž๋Š” ์†Œ์œ ๋œ(owned)์ฐฝ์ด๋‹ค.


๐Ÿ“Œ Window Handles

window๋Š” ๊ฐœ์ฒด์ด๋ฉฐ ์ฝ”๋“œ์™€ ๋ฐ์ดํ„ฐ๊ฐ€ ๋ชจ๋‘ ์žˆ์ง€๋งŒ C++ ํด๋ž˜์Šค๋Š” ์•„๋‹ˆ๋‹ค. ๋Œ€์‹  ํ”„๋กœ๊ทธ๋žจ์€ ํ•ธ๋“ค(handle) ์ด๋ผ๋Š” ๊ฐ’์„ ์‚ฌ์šฉํ•˜์—ฌ ์ฐฝ์„ ์ฐธ์กฐํ•œ๋‹ค. ํ•ธ๋“ค์€ ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐœ์ฒด๋ฅผ ์‹๋ณ„ํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋˜๋Š” ์ˆซ์ž์ผ ๋ฟ์ด๋‹ค.
Windows๊ฐ€ ๋งŒ๋“  ๋ชจ๋“  ์ฐฝ์ด ๋‹ด๊ธด ํฐ ํ…Œ์ด๋ธ”์ด ์žˆ๋‹ค๊ณ  ๊ฐ„์ฃผํ•˜๊ณ , ์ด ํ…Œ์ด๋ธ”์„ ์‚ฌ์šฉํ•˜์—ฌ ํ•ธ๋“ค๋กœ ์ฐฝ์„ ์กฐํšŒํ•œ๋‹ค. ์ฐฝ ํ•ธ๋“ค์˜ ๋ฐ์ดํ„ฐ ํ˜•์‹์€ ์ผ๋ฐ˜์ ์œผ๋กœ HWND์ด๋‹ค. (aitch-wind๋กœ ๋ฐœ์Œ) ์ฐฝ ํ•ธ๋“ค์€ ์ฐฝ์„ ๋งŒ๋“œ๋Š” ํ•จ์ˆ˜ CreateWindow ๋ฐ CreateWindowEx์—์„œ ๋ฐ˜ํ™˜๋œ๋‹ค.

์ฐฝ์—์„œ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๋ ค๋ฉด ์ผ๋ฐ˜์ ์œผ๋กœ HWND ๊ฐ’์„ ๋งค๊ฐœ ๋ณ€์ˆ˜๋กœ ๋ฐ›๋Š” ์ผ๋ถ€ ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ํ™”๋ฉด์˜ ์ฐฝ ์œ„์น˜๋ฅผ ๋ณ€๊ฒฝํ•˜๋ ค๋ฉด MoveWindow ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค.

BOOL MoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, BOOL bRepaint);

์—ฌ๊ธฐ์„œ ์ฒซ๋ฒˆ์งธ ๋งค๊ฐœ๋ณ€์ˆ˜ HWND hWnd๊ฐ€ ์ด๋™ํ•˜๋ ค๋Š” ์ฐฝ์— ๋Œ€ํ•œ ํ•ธ๋“ค์ด๋‹ค.

ํ•ธ๋“ค์€ ํฌ์ธํ„ฐ๊ฐ€ ์•„๋‹ˆ๋‹ค.


๐Ÿ“Œ Screen and Window Coordinates

์ขŒํ‘œ๋Š” ๋””๋ฐ”์ด์Šค์— ๋…๋ฆฝ์ ์ธ ํ”ฝ์…€(device-independent pixels)๋กœ ์ธก์ •๋œ๋‹ค.

์ž‘์—…์— ๋”ฐ๋ผ ํ™”๋ฉด์„ ๊ธฐ์ค€์œผ๋กœ, ์ฐฝ(ํ”„๋ ˆ์ž„ ํฌํ•จ)์„ ๊ธฐ์ค€์œผ๋กœ ๋˜๋Š” ์ฐฝ์˜ ํด๋ผ์ด์–ธํŠธ ์˜์—ญ์„ ๊ธฐ์ค€์œผ๋กœ ์ขŒํ‘œ๋ฅผ ์ธก์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.

๊ฐ ๊ฒฝ์šฐ์— ์›์ (0,0)์€ ํ•ญ์ƒ ์˜์—ญ์˜ ์™ผ์ชฝ ์œ„ ๋ชจํ‰์ด์ด๋‹ค.




๐Ÿ“ WinMain: The Application Entry Point

๋ชจ๋“  Windows ํ”„๋กœ๊ทธ๋žจ์—๋Š” WinMain ๋˜๋Š” wWinMain ์ด๋ผ๋Š” ์ง„์ž…์  ํ•จ์ˆ˜๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ๋‹ค.

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow);
  • hinstance : "์ธ์Šคํ„ด์Šค์— ๋Œ€ํ•œ ํ•ธ๋“ค" ๋˜๋Š” "๋ชจ๋“ˆ์— ๋Œ€ํ•œ ํ•ธ๋“ค"์ด๋ผ๊ณ  ํ•œ๋‹ค. ์šด์˜ ์ฒด์ œ๋Š” ์ด ๊ฐ’์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฉ”๋ชจ๋ฆฌ์— ๋กœ๋“œ๋  ๋•Œ ์‹คํ–‰ ํŒŒ์ผ(exe)๋ฅผ ์‹๋ณ„ํ•œ๋‹ค. ์ธ์Šคํ„ด์Šค ํ•ธ๋“ค์€ ํŠน์ • Windows ํ•จ์ˆ˜(ex.์•„์ด์ฝ˜ ๋˜๋Š” ๋น„ํŠธ๋งต ๋กœ๋“œ)์— ํ•„์š”ํ•˜๋‹ค.
  • hPrevInstance : 16๋น„ํŠธ Windows์—์„œ ์‚ฌ์šฉ๋˜์—ˆ์œผ๋‚˜ ์ง€๊ธˆ์€ ์˜๋ฏธ๊ฐ€ ์—†๋‹ค.
  • pCmdLine : ๋ช…๋ น์ค„ ์ธ์ˆ˜๋ฅผ ์œ ๋‹ˆ์ฝ”๋“œ ๋ฌธ์ž์—ด๋กœ ํฌํ•จ
  • nCmdShow : ๊ธฐ๋ณธ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ฐฝ์ด ์ตœ์†Œํ™”, ์ตœ๋Œ€ํ™” ๋˜๋Š” ์ •์ƒ์ ์œผ๋กœ ํ‘œ์‹œ๋˜๋Š”์ง€ ์—ฌ๋ถ€๋ฅผ ํ‘œ์‹œํ•˜๋Š” ํ”Œ๋ž˜๊ทธ

ํ•จ์ˆ˜๋Š” int ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•˜๋ฉฐ ์ด ๋ฐ˜ํ™˜ ๊ฐ’์ด ์šด์˜์ฒด์ œ์—์„œ ์‚ฌ์šฉ๋˜์ง€๋Š” ์•Š์ง€๋งŒ ๋ฐ˜ํ™˜ ๊ฐ’์„ ์‚ฌ์šฉํ•˜์—ฌ ์ž‘์„ฑํ•˜๋Š” ๋‹ค๋ฅธ ํ”„๋กœ๊ทธ๋žจ์— ์ „๋‹ฌํ•  ์ˆ˜ ์žˆ๋‹ค.

  • WINAPI : ํ˜ธ์ถœ ๊ทœ์น™. ํ•จ์ˆ˜๊ฐ€ ํ˜ธ์ถœ์ž๋กœ๋ถ€ํ„ฐ ๋งค๊ฐœ ๋ณ€์ˆ˜๋ฅผ ๋ฐ›๋Š” ๋ฐฉ๋ฒ•์„ ์ •์˜. ์˜ˆ๋ฅผ ๋“ค์–ด ์Šคํƒ์— ๋งค๊ฐœ ๋ณ€์ˆ˜๊ฐ€ ํ‘œ์‹œ๋˜๋Š” ์ˆœ์„œ๋ฅผ ์ •์˜ํ•œ๋‹ค.

WinMain ํ•จ์ˆ˜๋Š” ๋ช…๋ น์ค„ ์ธ์ˆ˜๊ฐ€ ANSI ๋ฌธ์ž์—ด๋กœ ์ „๋‹ฌ๋œ๋‹ค๋Š” ์ ์„ ์ œ์™ธํ•˜๊ณ  wWinMain๊ณผ ๋™์ผํ•˜๋‹ค.

๐Ÿ”Ž ๋นˆ WinMain ํ•จ์ˆ˜

INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    PSTR lpCmdLine, INT nCmdShow)
{
    return 0;
}
profile
๊ณต๋ถ€์ •๋ฆฌ์šฉ
post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€