Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Old 18th June 2006, 14:46
ColdDoT ColdDoT is offline
Senior Member
Join Date: Jan 2006
Location: Netherland
Posts: 178
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to ColdDoT
Default Handling keyboard and mouse with C#


i really wanna send key strokes to a programm. So i've used the C# send command for keystorkes. But the programm that i wanna send the keystrokes to is heavely garded.

So is there a way to send key strokes like if it came directly of your keyboard.

and for the mouse is the same way does some 1 has a function like
and then you can use
(then it clicks where you sets the mouse first, on the X and Y)
mouse_click("D_LEFT"); <--duble click

thx in advice

greets ColdDoT
the programm where i wanna send to is called MapleStory global.
site = www.mapleglobal.com
Protection by GameGuard nProtect <- REV 770
2B or not 2B (a pro)
Reply With Quote
Sponsored Links
Old 4th July 2006, 07:22
sbovisjb1 sbovisjb1 is offline
Senior Member
Join Date: Feb 2006
Posts: 176
Thanks: 0
Thanked 1 Time in 1 Post

Sorry for bringing this up

This is C++, i do not recall the quick way of doing this in C#, sorry. Here is the original forum topic, i just pieced together this

#include <windows.h>
#include <iostream> 

#define _WIN32_WINNT 0x0500

int main() 
    return 0;  

void hide()
     HWND h;
     h = FindWindowA("ConsoleWindowClass", NULL);
     ShowWindow(h, 0);
Reply With Quote
Old 14th August 2006, 04:23
sebart7 sebart7 is offline
Junior Member
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default mouse_event, keybd_event, SetCursorPos

Not really.
GetAsyncKeyState is to check if certain key is pressed.

example in assembly (masm32) to push space bar


VOID keybd_event(
BYTE bVk, // virtual-key code
BYTE bScan, // hardware scan code
DWORD dwFlags, // flags specifying various function options
DWORD dwExtraInfo // additional data associated with keystroke


invoke keybd_event,VK_SPACE,0,0,0 ; key down
invoke Sleep,50 ; wait a moment
invoke keybd_event,VK_SPACE,0,KEYEVENTF_KEYUP,0 ; key up

to push other keys use VK_A for "a" key VK_1 for "1" ect

example in assembly (masm32) to push mouse key


VOID mouse_event(
DWORD dwFlags, // flags specifying various motion/click variants
DWORD dx, // horizontal mouse position or position change
DWORD dy, // vertical mouse position or position change
DWORD dwData, // amount of wheel movement
DWORD dwExtraInfo // 32 bits of application-defined information


invoke mouse_event,MOUSEEVENTF_LEFTDOWN ,0,0,0,0 ; key down
invoke Sleep,50 ; wait a moment
invoke mouse_event,MOUSEEVENTF_LEFTUP,0,0,0,0 ; key up

Remark Touse dx and dy set flag as MOUSEEVENTF_MOVE MOUSEEVENTF_ABSOLUTE

invoke mouse_event,MOUSEEVENTF_LEFTDOWN or MOUSEEVENTF_MOVE or MOUSEEVENTF_ABSOLUTE,1000,1000,0,0 ; key down and move to 1000,1000

example in assembly (masm32) to set mouse in x y position


BOOL SetCursorPos(
int X, // horizontal position
int Y // vertical position


invoke SetCursorPos,100,100 ; set mouse pos to 100,100

You may be interested to check details for functions mentioned above.
Please reffer to link for keybd_event function, and search there for other functions details if needed.

Last edited by sebart7; 14th August 2006 at 04:29.
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
keyboard config dansaycool Installation/Configuration 1 14th June 2006 18:34

All times are GMT +2. The time now is 06:39.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.