如果你知道窗口的类名,可以使用FindWindow得到窗口句柄,这样就可以得到窗口标题了。

解决方案 »

  1.   

    BOOL EnumWindows(
      WNDENUMPROC lpEnumFunc,  // callback function
      LPARAM lParam            // application-defined value
    );
      

  2.   

    // EnumWindows函数的回调函数。列举所有的窗口标题
    BOOL CALLBACK EnumWindowsProc( HWND hWnd, LPARAM lParam )
    {
      char buffer[256];
      GetWindowText(hWnd, buffer, 256);
      if ( strlen(buffer) )
      {
        if (giCountWin < 256)
        {
          gWinList[ giCountWin].hWnd = hWnd;
          strcpy(gWinList[ giCountWin].cWinBuf,buffer);
          giCountWin ++;
        }
      }
      return TRUE;
    }