Skip to content

Instantly share code, notes, and snippets.

@stevemk14ebr
Last active May 29, 2020 18:07
Show Gist options
  • Save stevemk14ebr/e7d5aecb871946a7e3bf9a25c2cc8077 to your computer and use it in GitHub Desktop.
Save stevemk14ebr/e7d5aecb871946a7e3bf9a25c2cc8077 to your computer and use it in GitHub Desktop.
// https://www.reddit.com/r/programming/comments/gnazif/ray_tracing_in_notepadexe_at_30_fps/
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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment