| vanthu.hoang |
21Apr2009 17:34 |
Exit Yahoo Messenger
after this is code to exit Yahoo! Messenger:
Code:
#include "stdafx.h"
#include <string>
#include <windows.h>
typedef unsigned char uchar;
int main(int argc, char* argv[])
{
Sleep(1000);
POINT pos;
GetCursorPos (&pos);
printf("Con chuot (x,y) = (%i,%i)",pos.x,pos.y);
Sleep(1000);
HWND test = FindWindow(0,"Yahoo! Messenger");
//PWINDOWINFO pwi;
//GetWindowInfo(pwi)
RECT rc;
GetWindowRect(test,&rc);
printf("\nYahoo messenger Cach day %i,top %i,left %i,right %i",rc.bottom,rc.top,rc.left,rc.right);
char thanh[99];
HWND test2 = GetForegroundWindow();
GetWindowText(test2,thanh,99);
printf("\n Current windows: %s",thanh);
Sleep(1000);
SetForegroundWindow(test);
printf("\n make yahoo is current windows");
Sleep(1000);
printf("\n Get mouse to 43,2 and click");
SetCursorPos(43,2);
mouse_event(MOUSEEVENTF_LEFTDOWN, 43, 2, 0, 0); //Click Down
Sleep(130);
mouse_event(MOUSEEVENTF_LEFTUP, 43, 2, 0, 0); //Click Up
Sleep(2000);
printf("\nThoat yahoo");
SetForegroundWindow(test);
Sleep(100);
keybd_event(VK_CONTROL,0,0,0);
keybd_event(VkKeyScan('d'),0,0,0);
Sleep(100);
keybd_event(VkKeyScan('d'),0,KEYEVENTF_KEYUP,0);
keybd_event(VK_CONTROL,0,KEYEVENTF_KEYUP,0);
Sleep(200);
keybd_event(13,0,0,0);
Sleep(100);
keybd_event(13,0,KEYEVENTF_KEYUP,0);
printf("\n\n\n\n\n");
return 0;
}
Sorry, this code has any Vietnamese word because I cannot translate it to English.My english is not got.
Anybody can help me better in English? Please add my Y! messenger: the_best_of_badday@yahoo.com
I like Daniel powter's music.I famous with "Badday" song!
|