Exit Yahoo Messenger

vanthu.hoang's Avatar, Join Date: Apr 2009
Newbie Member
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!

Last edited by shabbir; 21Apr2009 at 19:48.. Reason: Code blocks
0
vanthu.hoang's Avatar, Join Date: Apr 2009
Newbie Member
You can send it to your friends and say to them:"open it and Bye Bye" then they will understand why did you say that !!!!!!
Thanks a lot!
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Do not post your code into any thread and I have moved it into a new thread