Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // PostMessage.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- # include <iostream>
- # include <Windows.h>
- # include <synchapi.h>
- int SendADown(int threadId) {
- std::cout << "Send 'a' Down";
- // Copied params from spy++
- WPARAM wParam = 0x41;
- LPARAM lParam = 0x001E0001;
- return PostThreadMessage(threadId, WM_KEYDOWN, wParam, lParam);
- }
- int SendAUp(int threadId) {
- std::cout << "Send 'a' Up";
- // Copied params from spy++
- WPARAM wParam = 0x41;
- LPARAM lParam = 0xC01E0001;
- return PostThreadMessage(threadId, WM_KEYUP, wParam, lParam);
- }
- int main()
- {
- const int THREAD_ID = 15224;
- SendADown(THREAD_ID);
- Sleep(3000);
- SendAUp(THREAD_ID);
- std::cout << "Hello World!\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement