Im working on a program that sends a string to the specified window, like an auto-typer.

So far ive finished the code to actually find the HWND of the window i want to send the string to.

Ive tried it out using notepad and it works fine:


Code:
SendMessage(hWnd, WM_CHAR, 65, 0);
Notepad seems to work fine with this, but when i try using:


Code:
SendMessage(hWnd, WM_KEYUP, 45, 0);
SendMessage(hWnd, WM_KEYDOWN, 45, 0);
nothing happens...

I think it might be a problem with the lParam, but i have no idea what value to set it to, i checked MSDN and my Win32 API Documentation, and they give me this table that i really didnt understand.

Also, i do not want to use keybd_event or SendInput since they require the program to be in focus.

Ive used Spy++ to see what messages get sent while normally using the program, and it sends WM_KEYDOWN then WM_CHAR then WM_KEYUP, ive tried doing that in the same order, but it doesnt show up.

Notepad only received input when i sent the WM_CHAR message, so im trying to find out what value i have to pass into lParam to make it work.

(I know its only a notification message, but i really dont know any other way, if theres a way to actually send the input to the program without it being in focus, then could someone please post it)

Thanks,

PaYnE