Game Dev/Article

Send Stream to Notepad

AKer 2008. 6. 9. 10:34
반응형
void OutputNotepad(LPCTSTR formatstring, ...)
{
	// 메모장 찾기
	HWND hWnd = ::FindWindow(L"Notepad", NULL); 
	if (hWnd)
	{
		// 편집 윈도우 찾기
		HWND hChild = ::FindWindowEx(hWnd, NULL, L"Edit", NULL); 
		if (hChild)
		{
			TCHAR buff[MAX_PATH] = {0};
			va_list args;
			va_start(args, formatstring);
			int nSize = _vsnwprintf(buff, sizeof(buff), formatstring, args);
			SendMessage(hChild, EM_REPLACESEL, 0, (LPARAM)buff);
		}
	}
}
반응형