CMainframe成员函数里有吧?
如果没有,试着用GetWindow 加上参数。(呀,这里居然没有MSDN !!!Faint)

解决方案 »

  1.   

    HWND          hPowerpoint,hCloseWindow;
    char          ChildWinName[30];
    CString       m_sOpenPptName;          //列举Powerpoint窗口的所有子窗口的回调函数
    BOOL CALLBACK
    EnumChildProc(HWND hwnd, LPARAM arg)
    {
    if(strcmp(ChildWinName,"")==0)  return TRUE;
    CWnd *pWnd=CWnd::FromHandle( hwnd );  //注意这一行
    if( pWnd->IsWindowVisible() )
    {
      CString  subwn;
      pWnd->GetWindowText(subwn);
      if(strcmp(subwn,ChildWinName)==0)
      {
       ShowWindow(hwnd,SW_SHOWNORMAL);
       hCloseWindow=hwnd;
      }
    }
    return TRUE;
    }//列举所有顶层窗口的回调函数
    BOOL CALLBACK
    EnumWindowsFn(HWND hwnd, LPARAM arg)
    {
    hPowerpoint=NULL;
    char         str[30];
    char         temp[50];
    char         tempchar[2];
    bool         start=false;
    GetWindowText(hwnd,str,21);
      if(strcmp(str,"Microsoft PowerPoint")==0)
    {
    BringWindowToTop(hwnd);
    GetWindowText(hwnd,temp,50);
    strcpy(ChildWinName,""); for(int i=0;i<50;i++)
    {
    if( temp[i]=='[' )
    {
    start=true;
    continue; 
    }
    if( temp[i]==']' ) 
    {
    break;
    }
    if(start)
    {
    tempchar[0]=temp[i];
    tempchar[1]='\0';
    strcat(ChildWinName,tempchar);
    }
    }
    if(strcmp(ChildWinName,"")==0) return true;

    hPowerpoint=hwnd;
    if(hPowerpoint!=NULL)
    {
               EnumChildWindows(hPowerpoint,EnumChildProc,NULL);
    }
    }
       return true;

    如果有问题:[email protected]