http://www.csdn.net/expert/Topic/477/477918.shtm

解决方案 »

  1.   

    看了
    但有时候我并不一定能得到hwnd
      

  2.   

    我的意思是说不一定能让另一应用程序返回hwnd,必须要由原来的那个应用程序想办法去取
      

  3.   

    这类操作操作虽不是很难,但也要对系统编程熟悉。
    我这里有一个类似于SpyXX的例子,是源于《VB6编程高手》
    如需要可以发给你!
      

  4.   

    HWND FindWindow(    LPCTSTR lpClassName, // pointer to class name
        LPCTSTR lpWindowName  // pointer to window name
       );
     ParameterslpClassNamePoints to a null-terminated string that specifies the class name or is an atom that identifies the class-name string. If this parameter is an atom, it must be a global atom created by a previous call to the GlobalAddAtom function. The atom, a 16-bit value, must be placed in the low-order word of lpClassName; the high-order word must be zero. lpWindowNamePoints to a null-terminated string that specifies the window name (the window's title). If this parameter is NULL, all window names match.  Return ValuesIf the function succeeds, the return value is the handle to the window that has the specified class name and window name.
    If the function fails, the return value is NULL. To get extended error information, call GetLastError
    . See AlsoEnumWindows, FindWindowEx, GetClassName, GlobalAddAtom 
    这样找dim hnd as long
    hnd=findwindow(0,"另一个程序的窗体标题")
    这就可以了
      

  5.   

    不好 意思 错了应该是Dim hnd As Long
    hnd=findwindow(vbNullString,"另一个程序的窗体标题")
      

  6.   

    to Bardo(巴顿)
    谢谢,最好是有例子了
    [email protected]
      

  7.   

    to lx_king(天剑) 
    因为我不一定知道另一个应用程序的类是什么,所以光有findwindow不行
    不过还是谢谢你
      

  8.   

    标题都不知道??那你就 用EnumWindows列出所有的窗体名称判断吧给你个例子 看看吧
      

  9.   

    to lx_king(天剑)
    例子已收到,等我先调试,过回再结贴