m_hRoot=::GetAncestor(hWnd,GA_ROOT);
这个语句在VC6中不能编译通过,请各位指教?!

解决方案 »

  1.   

    不需装新的SDK在stdafx.h里面.#define WINVER 0x0500
    100分拿来!哈哈
      

  2.   

    在stdafx.h里面.#define WINVER 0x0500
      

  3.   

    GetAncestor
    The GetAncestor function retrieves the handle to the ancestor of the specified window. HWND GetAncestor(
      HWND hwnd,    // handle to window
      UINT gaFlags  // ancestor
    );
    Parameters
    hwnd 
    [in] Handle to the window whose ancestor is to be retrieved. If this parameter is the desktop window, the function returns NULL. 
    gaFlags 
    [in] Specifies the ancestor to be retrieved. This parameter can be one of the following values. Value Meaning 
    GA_PARENT Retrieves the parent window. This does not include the owner, as it does with the GetParent function.  
    GA_ROOT Retrieves the root window by walking the chain of parent windows. 
    GA_ROOTOWNER Retrieves the owned root window by walking the chain of parent and owner windows returned by GetParent.  
    Return Values
    The return value is the handle to the ancestor window.Requirements 
      Windows NT/2000: Requires Windows NT 4.0 SP4 or later.
      Windows 95/98: Requires Windows 98.
      Header: Declared in Winuser.h; include Windows.h.
      Library: Use User32.lib.
      

  4.   

    在stdafx.h里面.#define WINVER 0x0500
      

  5.   

    在stdafx.h里面.#define WINVER 0x0500
      

  6.   

    在stdafx.h里面.#define WINVER 0x0500而且要定义到前面才可以。给分咯。
      

  7.   

    #if(WINVER >= 0x0500) CWnd* GetAncestor(UINT gaFlags) const;#endif // WINVER >= 0x0500
      

  8.   

    不行?你说说你在stdafx.h里面怎么弄的?
      

  9.   

    在stdafx.h里面.#define WINVER 0x0500
      

  10.   

    // stdafx.h : include file for standard system include files,
    //  or project specific include files that are used frequently, but
    //      are changed infrequently
    //#if !defined(AFX_STDAFX_H__90C1F127_CE50_4337_8C7B_5FE34273F251__INCLUDED_)
    #define AFX_STDAFX_H__90C1F127_CE50_4337_8C7B_5FE34273F251__INCLUDED_
    #define WINVER 0x0500
    #if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000// Insert your headers here
    #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers#include <windows.h>#include "..\\common_win\\DBWindow.h"
    // TODO: reference additional headers your program requires here//{{AFX_INSERT_LOCATION}}
    // Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_STDAFX_H__90C1F127_CE50_4337_8C7B_5FE34273F251__INCLUDED_)