是用findwindow要给出窗口的名称,但是我就是要获取我本程序默认窗口的句柄,不按照名称来,怎么弄?

解决方案 »

  1.   

    问题不太明白,不过应该可以用GetSafeHwnd()函数解决
      

  2.   

    在MFC当中,用AfxGetMainWnd得到本程序默认窗口的句柄,具体函数声明如下:CWnd* AfxGetMainWnd( );Return ValueIf the server has an object that is in-place active inside a container, and this container is active, this function returns a pointer to the frame window object that contains the in-place active document. If there is no object that is in-place active within a container, or your application is not an OLE server, this function simply returns the m_pMainWnd of your application object.If AfxGetMainWnd is called from the application's primary thread, it returns the application's main window according to the above rules. If the function is called from a secondary thread in the application, the function returns the main window associated with the thread that made the call.