我的做法是:
通过findwindowex查找ie窗口,然后用setactivewindow来激活但是每个ie窗口的标题都相同,每次只能找到第一个窗口,因而每次只能激活第一ie窗口,哪位大侠能解决这个问题呢?

解决方案 »

  1.   

    能不能详细一点 对enumwindows 不是很熟悉
    谢谢
      

  2.   

    EnumWindows
    The EnumWindows function enumerates all top-level windows on the screen by passing the handle to each window, in turn, to an application-defined callback function. EnumWindows continues until the last top-level window is enumerated or the callback function returns FALSE. BOOL EnumWindows(
      WNDENUMPROC lpEnumFunc,  // pointer to callback function
      LPARAM lParam            // application-defined value
    );
     
    Parameters
    lpEnumFunc 
    Pointer to an application-defined callback function. For more information, see EnumWindowsProc. 
    lParam 
    Specifies an application-defined value to be passed to the callback function. 
    Return Values
    If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. To get extended error information, callGetLastError.Res
    The EnumWindows function does not enumerate child windows. This function is more reliable than calling the GetWindow function in a loop. An application that calls GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window that has been destroyed. EnumWindowsProc
    The EnumWindowsProc function is an application-defined callback function used with the EnumWindows orEnumDesktopWindows function. It receives top-level window handles. The WNDENUMPROC type defines a pointer to this callback function. EnumWindowsProc is a placeholder for the application-defined function name. BOOL CALLBACK EnumWindowsProc(
      HWND hwnd,      // handle to parent window
      LPARAM lParam   // application-defined value
    );
     
    Parameters
    hwnd 
    Handle to a top-level window. 
    lParam 
    Specifies the application-defined value given in EnumWindows or EnumDesktopWindows. 
    Return Values
    To continue enumeration, the callback function must return TRUE; to stop enumeration, it must return FALSE. Res
    An application must register this callback function by passing its address to EnumWindows or EnumDesktopWindows. 
      

  3.   

    bool bRet;
      //枚举顶层窗口
      bRet=EnumWindows((WNDENUMPROC)EnumWindowsProc,lmyParam);为什么会出现这样错误:cannot convert from '' to 'int (__stdcall *)(struct HWND__ *,long)'