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

Get balloon tips text of other applications.

Discussion in 'MFC' started by shabbir, May 16, 2008.

  1. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,287
    Likes Received:
    364
    Trophy Points:
    83

    Introduction



    How to get the balloon tips text displayed by other applications.

    Background



    I once wanted to get the Balloon Tips text and analyze what is the error caused the balloon tip to popuped and so wanted to get the frequency of such occurance. The existing application would not take the burden and so I needed a new Application which would do the task and I thought it to be a simple task where I will find the window and extract the window text using the GetWindowText API

    Now the first question that came to my mind was what should I Find for. Spy ( :whip: ) gave me the answer and it should be Windows of class tooltips_class32

    So I successfully found the Window Handle
    HWND hWnd = ::FindWindow("tooltips_class32",NULL);

    Then I thought its just one statement away ::GetWindowText but then the API did not return anything and I was just scratching my head.

    Again getting the aspiration from Spy ( As it was showing the text I needed ) just thought of doing some more R&D and found out the solution.

    Here it comes
    Code:
    char *bufText = NULL;
    int iLen;
    
    HWND hWnd = ::FindWindow("tooltips_class32",NULL); // Find the Tool Tip Window
    iLen = ::SendMessage(hWnd,WM_GETTEXTLENGTH,0,0); // Send the Message to get the Text Length
    bufText = new char[iLen]; // Allocate the buffer
    ::SendMessage(hWnd,WM_GETTEXT,(WPARAM)iLen,(LPARAM)bufText ); // Get the needed text
    
    There is nothing thats done differently but remember that sometimes it get out of MFC to handle the code and you need to go back to basics i.e. Win32 way of getting text. :2thumbsup

    To display a balloon tip use [thread=343]Display a System Tray Icon in VC++[/thread] and use a new flag (available where _WIN32_IE >= 0x0500), NIF_INFO, which lets you display a balloon tip. The text goes in szInfo and the message in szInfoTitle.

    References



    [thread=343]Display a System Tray Icon in VC++[/thread]
     
  2. ravi_18nov

    ravi_18nov New Member

    Joined:
    Aug 29, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Programer
    Location:
    Pune
    Re: Set balloon tips text of other applications.

    Hi Experts
    I read your Article from which i could found tooltip text
    Thanks a lot
    But now I also want to reset that tooltips according to user
    so am using following approach but I failed.. Plz Help me ...
    :nonod:
    ::SendMessageW(hWndToolTip,WM_SETTEXT,(WPARAM)iToolTipLen*5,(LPARAM)ToolTip_Unicode);


    Whats going wrong with this code...plz provide the solution
    Thanks a lot...
     

Share This Page