1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Exit Yahoo Messenger

Discussion in 'C' started by vanthu.hoang, Apr 21, 2009.

  1. vanthu.hoang

    vanthu.hoang New Member

    Joined:
    Apr 21, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    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 a moderator: Apr 21, 2009
  2. vanthu.hoang

    vanthu.hoang New Member

    Joined:
    Apr 21, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Re: GetCursorPos

    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!
     
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    Do not post your code into any thread and I have moved it into a new thread
     

Share This Page