Hey guys,
Im using this code to write "hi" to notepad:
Code:
#define _WIN32_WINNT 0x0500
#include "windows.h"
void SendKey(BYTE vKey)
{
INPUT Input;
ZeroMemory(&Input, sizeof(Input));
Input.type = INPUT_KEYBOARD;
Input.ki.dwFlags = KEYEVENTF_EXTENDEDKEY;
Input.ki.wVk = vKey;
SendInput(1, &Input, sizeof(INPUT));
}
int main()
{
HWND Notepad = FindWindow("Notepad", 0);
if(!Notepad) return 0;
SetForegroundWindow(Notepad);
Sleep(500);
SendKey((UCHAR)VkKeyScan('h'));
SendKey((UCHAR)VkKeyScan('i'));
return 0;
}
But if the notepad is minimized it won't work. Is there a way to write "Hi" to it WHILE IT IS MINIMIZED?