Hey guys, I was looking at sending keystrokes to an application.
I checked out the minesweep bot, but it's more mouse oriented.
Can someone tell me how I would send "<s>" to a window, please ?
(Especially the < and > symbols....)
Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo
void type_command(char * pChar)
{
int counter;
short letterke ;
int iLength = StrLen( pChar );
//UserName First... ugly hack.
for ( counter = 0; counter < iLength ; counter++ ) {
letterke = VkKeyScan( pChar[counter] );
KeyboardEvent( letterke , 0 );
KeyboardEvent( letterke , KEYEVENTF_KEYUP );
}
}
void press_enter()
{
KeyboardEvent( VK_RETURN , 0 );
KeyboardEvent( VK_RETURN , KEYEVENTF_KEYUP );
}
char * player1_username = "ikke";
char * player1_password = "ikke";
void Login()
{
type_command( player1_username );
Sleep(500);
press_enter();
type_command( player1_password );
Sleep(500);
press_enter();
}
char * player1_username = "ikke";
char * player1_password = "ikke";
void Login() {
Type( player1_username );
Sleep( 500 );
Type( '\r' );
Type( player1_password );
Sleep( 500 );
Type( '\r' );
}
void Write_Notepad()
{
//made the program sleep because I was too lazy to change the hotkey :P
Sleep(1000);
HWND hWnd = FindWindow("Untitled - Notepad");
if (!hWnd)
{
PrintF("Can't find Notepad...");
return;
}
PrintF("Found Notepad!");
SetForegroundWindow(hWnd);
char *msg = "Max";
Type(msg);
}
VOID On_HK_NOTEPAD_EXE_1( DWORD dw1, DWORD dw2 )
{
Write_Notepad();
}
void Write_Notepad()
{
KeyboardEvent( VK_SHIFT, KEYEVENTF_KEYUP );
KeyboardEvent( VK_CONTROL, KEYEVENTF_KEYUP );
KeyboardEvent( VK_MENU, KEYEVENTF_KEYUP );
HWND hWnd = FindWindow("Untitled - Notepad");
if (!hWnd)
{
PrintF("Can't find Notepad...");
return;
}
PrintF("Found Notepad!");
SetForegroundWindow(hWnd);
char *msg = "Max";
Type(msg);
}
Users browsing this forum: No registered users and 0 guests