FindWindow函数怎么用的?谁给详细说说

解决方案 »

  1.   

    HWND FindWindow(
      LPCTSTR lpClassName,  // 窗口的类名
      LPCTSTR lpWindowName  // 窗口的标题
    );两个参数有一个就成。找记事本的HWND(用类名):
    HWND hWndNotepad = ::FindWindow("Notepad",NULL);
      

  2.   

    The FindWindow function retrieves the handle to the top-level window whose class name and window name match the specified strings. This function does not search child windows. HWND FindWindow( 
    LPCTSTR lpClassName, 
    LPCTSTR lpWindowName ); 
    Parameters
    lpClassName 
    Long pointer 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. 
    lpWindowName 
    Long pointer to a null-terminated string that specifies the window name (the window’s title). If this parameter is NULL, all window names match. 
    Return Values
    A handle to the window that has the specified class name and window name indicates success. NULL indicates failure. To get extended error information, call GetLastError. msdn 的
      

  3.   

    //例
    if((hCurWindow= FindWindow(NULL,"QQ用户登录"))!=0||(hCurWindow=FindWindow(NULL,"OICQ用户登录"))!=0)
    {//很明显,调用FindWindow()函数去获得QQ登陆窗口的句柄
    String str;
    str.sprintf("0x%x",hCurWindow);
    }
      

  4.   

    回复人: papaya_stone(^_^)shentong(^_^) ( ) 信誉:108  2003-08-05 14:46:00  
    HWND FindWindow(
      LPCTSTR lpClassName,  // 窗口的类名
      LPCTSTR lpWindowName  // 窗口的标题
    );两个参数有一个就成。找记事本的HWND(用类名):
    HWND hWndNotepad = ::FindWindow("Notepad",NULL);窗口的标题"我的电脑"
    HWND hWnd = ::FindWindow(NULL,"我的电脑");
      

  5.   

    只做学习!找记事本的HWND(用类名):
    HWND hWndNotepad = ::FindWindow("Notepad",NULL);窗口的标题"我的电脑"
    HWND hWnd = ::FindWindow(NULL,"我的电脑");
      

  6.   

    用spy++就可以查看窗口的类名。
      

  7.   

    HWND FindWindow(
      LPCTSTR lpClassName,  // 窗口的类名
      LPCTSTR lpWindowName  // 窗口的标题
    );
    只要知道窗口的名字就可以了 然后将第一个参数LPCTSTR lpClassName设为NULL 就可以了 
    用一个句柄接收就OK了
      

  8.   

    用spy++,撒子类名,窗口名都看得到
      

  9.   

    HWND hwnd;
    hwnd = ::FindWindow(NULL, "我的程序的标题");