我是要作监视程序,用这个监视程序来监视其它程序中出现的tooltip!!!

解决方案 »

  1.   

    用Timer不断检查
    看有没有类名为“tooltips_class32”的窗口(用FindWindow查找)
    再发送“TTM_GETTEXT”消息得到文本TTM_GETTEXT
    TTM_GETTEXT 
        wParam = 0; 
        lParam = (LPARAM) (LPTOOLINFO) lpti; Retrieves the information a tooltip control maintains about a tool. No return value. 
    lpti 
    Address of a TOOLINFO structure. 
    The cbSize member of this structure must be filled in before sending this message. Set the hwnd and uId members to identify the tool for which to retrieve information. Set the lpszText member to point to a buffer that receives the text. There currently is no way to specify the size of the buffer or to determine the required buffer size. TOOLINFO
    typedef struct tagTOOLINFO{
        UINT      cbSize; 
        UINT      uFlags; 
        HWND      hwnd; 
        UINT      uId; 
        RECT      rect; 
        HINSTANCE hinst; 
        LPTSTR    lpszText; 
    #if (_WIN32_IE >= 0x0300)
        LPARAM lParam;
    #endif
    } TOOLINFO, NEAR *PTOOLINFO, FAR *LPTOOLINFO; Contains information about a tool in a tooltip control. cbSize 
    Size of the TOOLINFO structure, in bytes. This member must be specified. 
    uFlags 
    Set of bit flags. This member can be a combination of the following flags: TTF_ABSOLUTE  Version 4.70. Positions the tooltip window at the same coordinates provided by TTM_TRACKPOSITION. This flag must be used with the TTF_TRACK flag. 
    TTF_CENTERTIP Centers the tooltip window below the tool specified by the uId member. 
    TTF_IDISHWND Indicates that the uId member is the window handle to the tool. If this flag is not set, uId is the tool's identifier. 
    TTF_RTLREADING Displays text using right-to-left reading order on Hebrew or Arabic systems.  
    TTF_SUBCLASS Indicates that the tooltip control should subclass the tool's window to intercept messages, such asWM_MOUSEMOVE. If not set, you must use the TTM_RELAYEVENT message to forward messages to the tooltip control. For a list of messages that a tooltip control processes, see TTM_RELAYEVENT. 
    TTF_TRACK Version 4.70. Positions the tooltip window next to the tool to which it corresponds and moves the window according to coordinates supplied by the TTM_TRACKPOSITION messages. You must activate this type of tool using the TTM_TRACKACTIVATE message. 
    TTF_TRANSPARENT Version 4.70. Causes the tooltip control to forward mouse event messages to the parent window. This is limited to mouse events that occur within the bounds of the tip window.  hwnd 
    Handle to the window that contains the tool. If lpszText includes the LPSTR_TEXTCALLBACK value, this member identifies the window that receives the TTN_GETDISPINFO notification messages. 
    uId 
    Application-defined identifier of the tool. If uFlags includes the TTF_IDISHWND flag, uId must specify the window handle to the tool. 
    rect 
    Tool's bounding rectangle coordinates. The coordinates are relative to the upper-left corner of the client area of the window identified by hwnd. If uFlags includes the TTF_IDISHWND flag, this member is ignored. 
    hinst 
    Handle to the instance that contains the string resource for the tool. If lpszText specifies the identifier of a string resource, this member is used. 
    lpszText 
    Address of the buffer that contains the text for the tool, or identifier of the string resource that contains the text. If this member is set to the LPSTR_TEXTCALLBACK value, the control sends the TTN_NEEDTEXT notification message to the owner window to retrieve the text. 
    lParam 
    Version 4.70. A 32-bit application defined value that is associated with the tool.