http://www.baidu.com/s?ct=0&ie=gb2312&bs=%BB%F1%C8%A1+%CE%C4%B1%BE+%C6%E4%CB%FB%B4%B0%BF%DA&sr=&z=&wd=%BB%F1%C8%A1+%CE%C4%B1%BE+%C6%E4%CB%FB%B4%B0%BF%DA&cl=3&f=8
获取其他程序窗口的按钮文本,图像,如何做?
先获句柄?

解决方案 »

  1.   

    How can I get the text of another process' window? As you've probably found out by now, calling GetWindowText() won't work most of the time. The reason for this is that GetWindowText() won't do the necessary translation between the address spaces of the two processes. This is required because address that the calling process passes to GetWindowText() in the lpString parameter is not valid in the address space of the target process, so some translation is required. However, there is one way to get around it, and that is sending a WM_GETTEXT message to the target window. Now you might be wondering how this could work, if, after all, GetWindowText() sends a WM_GETTEXT message as part of its implementation. The answer is that Windows treats some messages differently when they are sent directly across process boundaries, and provides support for address translation (which is not a translation at all. Windows uses memory mapped files to accomplish the copy). WM_GETTEXT is one of those, as are WM_SETTEXT and WM_COPYDATA.Keep in mind, however, that this will not work for all windows, for the simple reason that they do not store their text using WM_SETTEXT and use their own buffers for it, but don't handle the WM_GETTEXT message appropriately.Finally, note that GetWindowText() will work under some circumstances在其他窗口输出调试信息
    Output --------------------------------------------------------------------------------
    This article was contributed by Eric Jésover. This program is showing all debug information when your program is running, not in the Debug output window of your compiler, but in an other window.
    The reason for DbgOut doesn't use OutputDebugString is to show always debug string in an other window (like in the old day Win 3.1).You can save, modify or print this information (DbgOut.exe is using an EditView from MFC)
    Main macro
    DBGOUT : show a formatting string
    DBGOUT_LASTERROR : Show last error message in an human way
    The main difference with Message Tacer is there are no lib to link. Only include DbgOut.h and voilà.
    You can see every OutputDebugString of processes not attach to a debugger, or string send by DBGOUT macro.Program optionAlways on top 
    show all OutputDebugString with the pid of the process who send it 
     You could find in this program :a way to run a single instance under NT. 
    managing UNICODE and ANSI string 
    an example of using WM_COPYDATA as IPC #include <DbgOut.h>
    .....
        int foo = 66;
        DBGOUT (_T("Something to say (%d)"), foo);
    .....
        if ( ! m_file.Open (pPath, CFile::modeRead | CFile::shareDenyWrite, &m_fileException))
        {
            DBGOUT_LASTERROR (_T("Open (%s)\n"), pPath);
            return FALSE;
        }鼠标屏幕取词 原理
    http://www.daima.com.cn/Info/38/Info6861/
      

  2.   

    http://www.bbou.com/vbnew/15/2894.html