前提是我这个窗口没有CAPTION.
也就是说用FindWindow函数, 无法指定caption.在win32下,不是MFC 还有其它方法吗?或者是如何修改FindWindow ?

解决方案 »

  1.   

    caption??是ClassName.
    EnumWindows可以查找.
      

  2.   

    ClassName也可以吧.
    窗口样式啊等等,都行的
      

  3.   

    窗口没标题不怕,肯定有类名,不过一个窗口类可以创建N个窗口,就算窗口标题也可以重复.
    区别窗口的唯一凭证就是HWND, 没有HWND你只能分析窗口特征了.
      

  4.   

    FindWindow 可以通过class name
    其他的可以用
    EnumWindows
      

  5.   

    也就是说findwindow函数的第一个参数,可以是对话框属性Class name中指定的值了 ?
      

  6.   

    把那个程序开着,用spy++可以看到它的类名的
      

  7.   

    在程序A中,被控制的窗口 struct Tag_STRUCT
    {
    HWND hWnd;
    } ;
       
    struct Tag_STRUCT Struct; Struct.hWnd = m_hWnd;
        WritePrivateProfileStruct("Section","Key",&Struct,sizeof(Struct),"C:\\1.ini");
    程序B中 struct Tag_STRUCT
    {
    HWND hWnd;
    } ;
       
    struct Tag_STRUCT Struct;    GetPrivateProfileStruct("Section","Key",&Struct,sizeof(Struct),"C:\\1.ini");
       
    HWND hwnd = ::FindWindow(NULL,"wuming"); if(hwnd != NULL)
    MessageBox("Found!"); if(hwnd == Struct.hWnd )
    MessageBox("the same !"); ::ShowWindow(hwnd,SW_HIDE);
      

  8.   

    FindWindow(窗体类名,NULL);还可以使用GetWindow来遍历窗口
      

  9.   

    你把鼠标放到窗口上,然后用WindowFromPoint
       
      The   WindowFromPoint   function   retrieves   a   handle   to   the   window   that   contains   the   specified   point.     
        
      HWND   WindowFromPoint(   
          POINT   Point     //   point   
      );   
      Parameters   
      Point     
      [in]   Specifies   a   POINT   structure   that   defines   the   point   to   be   checked.     
      Return   Values   
      The   return   value   is   a   handle   to   the   window   that   contains   the   point.   If   no   window   exists   at   the   given   point,   the   return   value   is   NULL.   If   the   point   is   over   a   static   text   control,   the   return   value   is   a   handle   to   the   window   under   the   static   text   control.     
      

  10.   

    SetProp 给窗口一个附加属性。
    GetProp //以下方法本人没用过,上面可以
    SetWindowLong
    GWL_USERDATA
    Sets the user data associated with the window. This data is intended for use by the application that created the window. Its value is initially zero.
      

  11.   

    FindWindow()与GetWindow()配合着使用