Language

Notepad ๋„์šฐ๊ธฐ - Process

๐“›๐“พ๐“ฌ๐“ฎ๐“ฝ๐“ฎ_๐“ข๐“ฝ๐“ฎ๐“ต๐“ต๐“ช 2022. 11. 7.
728x90
๋ฐ˜์‘ํ˜•

ํ•ด๋‹น ๋ธ”๋กœ๊ทธ๋Š” ํ•ดํ‚น ๋ฐ ๋ณด์•ˆ ๋ธ”๋กœ๊ทธ๋กœ ๊ณต๋ถ€ ๋ฐ ์—ฐ๊ตฌ์šฉ์œผ๋กœ ์ž‘์„ฑ๋˜์–ด์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์•„๋ž˜์˜ ๋‚ด์šฉ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•ดํ‚น ์‹œ๋„ ๋ฐ ์‹ค์ œ ๊ณต๊ฒฉ์„ ์‹œ๋„ํ•˜์—ฌ ์ผ์–ด๋‚˜๋Š” ๋ชจ๋“  ์ฑ…์ž„์€ ๋ณธ์ธ(๋”ฐ๋ผํ•œ์ž)์—๊ฒŒ ์žˆ์Œ์„ ์•Œ๋ ค๋“œ๋ฆฌ๋ฉฐ, ๊ธ€์“ด์ด๋Š” ์•„๋ฌด๋Ÿฐ ์ฑ…์ž„์„ ์ง€์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๊ผญ ๊ณต๋ถ€ ๋ฐ ์—ฐ๊ตฌ์šฉ์œผ๋กœ๋งŒ ์‚ฌ์šฉํ•˜์—ฌ ์ฃผ์‹œ๊ธธ ๋ฐ”๋ž๋‹ˆ๋‹ค. ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

๊ณผ๊ฑฐ์ž๋ฃŒ๋ฅผ ์ฐพ์•„๋ณด๋‹ค๊ฐ€ BoBํ• ๋•Œ ๊ณผ์ œ๋กœ ๋ฐ›์•˜๋˜ ๋‚ด์šฉ์ด ์žˆ์–ด์„œ ์ž‘์„ฑํ•ด๋ณธ๋‹ค.

๊ณผ์ œ๋Š” ๊ทธ๋ƒฅ Notepad๋ฅผ ๋„์šฐ๋Š” ๊ฑฐ์˜€๋Š”๋ฐ...

๊ธฐ์–ตํ•˜๊ธฐ๋กœ๋Š” ํŒŒ์ผํฌ๊ธฐ๋ฅผ ํŠน์ •ํ•˜๊ฒŒ ๋งŒ๋“ค์–ด์„œ notepad๋ฅผ ์ƒ์„ฑ ํ•˜๋Š” ๊ฑฐ์˜€๋‹ค.

#include <stdio.h>
#include <Windows.h>
#include <tchar.h>
#define DIR_LEN_BUFSIZE

int _tmain(int argc, TCHAR* argv[])
{
	STARTUPINFO si = { 0, };
	PROCESS_INFORMATION  pi;

	si.cb = sizeof(si);
	si.dwFlags = STARTF_USEPOSITION | STARTF_USESIZE;
	si.dwX = 100;
	si.dwY = 100;
	si.dwXSize = 300;
	si.dwYSize = 300;

	si.lpTitle = _T("Child process!");

	TCHAR command[] = _T("notepad ");

	BOOL state;

	state = CreateProcess(
		NULL,
		command,
		NULL, NULL,
		TRUE,
		CREATE_NEW_CONSOLE,
		NULL, NULL,
		&si,
		&pi
		);
	if (state != 0)
	{
		_fputts(_T("Creation OK! \n"), stdout);
	}
	else{
		_fputts(_T("Creation Fail! \n"), stdout);
	}
	return 0;
}

์ด๋ ‡๊ฒŒ ์ž‘์„ฑํ–ˆ๋˜ ๊ฒƒ์œผ๋กœ ์•ˆ๋‹ค. ์•ฝ 7~8๋…„์ „์˜ ๊ณผ์ œ์˜€๋˜ ๊ฒƒ๊ฐ™์€๋ฐ...

์ง€๊ธˆ์€ ์–ด๋–ค๋Š๋‚Œ์˜ ๊ณผ์ œ๋ฅผ ๋ฐ›์„์ง€ ๋ชจ๋ฃจ๊ฒ ๋‹ด!

728x90
๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€