Skip to content

Instantly share code, notes, and snippets.

@myfreeer
Created May 30, 2017 09:02
Show Gist options
  • Save myfreeer/10e8d73f2ab4bcf469a66996da94d150 to your computer and use it in GitHub Desktop.
Save myfreeer/10e8d73f2ab4bcf469a66996da94d150 to your computer and use it in GitHub Desktop.
#define UNICODE
#define _UNICODE
#include <windows.h>
//main entry
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd) {
const int cmdLineLength = lstrlenW(lpCmdLine);
if (cmdLineLength == 0) {
return 1;
}
for (int i = 0; i < cmdLineLength; i++) {
SendMessageW(GetForegroundWindow(), WM_CHAR, lpCmdLine[i], 0);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment