Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Exit Yahoo Messenger (http://www.go4expert.com/forums/exit-yahoo-messenger-t17018/)

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!

vanthu.hoang 21Apr2009 17:37

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!

shabbir 21Apr2009 19:51

Re: Exit Yahoo Messenger
 
Do not post your code into any thread and I have moved it into a new thread


All times are GMT +5.5. The time now is 11:36.