XWindows for WSL subsystem: Commercial


Brief bit of Windows lore: Using Notepad as a debug console for Windows programs:

static void nlog(char *str, ...)
{
	HWND notepad, edit;
	va_list ap;
	char buf[256];

	va_start(ap, str);
	vsprintf(buf, str, ap);
	va_end(ap);
	strcat(buf, "\r\n");
	notepad = FindWindow(NULL, "Untitled - Notepad");
	edit = FindWindowEx(notepad, NULL, "EDIT", NULL);
	SendMessage(edit, EM_REPLACESEL, TRUE, (LPARAM)buf);
}

... which is kinda a cool trick.


Win32 Assembly Language


Tags: platform   windows   native  

Last modified 06 April 2022