To generate keystrokes into Linux application

Hi Folks,

I need help to generate keystrokes in my existing application in LINUX environment. I am fully aware that there are libraries in Dev C++ which do exactly what I want but in Windows and I need something like that in Linux. I have googled a lot, but could not able to find any solution. Below are the code of Dev C++ library and I want something like that in Linux. Any help, suggestion , criticism are most welcome.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
void GenerateKey(int vk , BOOL bExtended)
{
KEYBDINPUT kb = {0};
INPUT Input = {0};

// generate down
if(bExtended)
kb.dwFlags = KEYEVENTF_EXTENDEDKEY;
kb.wVk = vk;

Input.type = INPUT_KEYBOARD;
Input.ki = kb;
::SendInput(1, &Input, sizeof(Input));
// generate up
::ZeroMemory(&kb, sizeof(KEYBDINPUT));
::ZeroMemory(&Input, sizeof(INPUT));

kb.dwFlags = KEYEVENTF_KEYUP;
if(bExtended)
kb.dwFlags |= KEYEVENTF_EXTENDEDKEY;

kb.wVk = vk;
Input.type = INPUT_KEYBOARD;
Input.ki = kb;
::SendInput(1, &Input, sizeof(Input));
} 


Thanks and regards,
SamPrat
the issue is solved.

Thanks
Topic archived. No new replies allowed.