在stdafx.h中加入下面的语句#ifndef WINVER
#define  WINVER 0x0501
#endif

解决方案 »

  1.   

    不行呀。我这里还是报:
    D:\我的文档\个人开发\cpp\DbyTool\DbyToolDlg.cpp(194) : error C2065: 'AW_SLIDE' : undeclared identifier
    D:\我的文档\个人开发\cpp\DbyTool\DbyToolDlg.cpp(194) : error C2065: 'AW_HOR_NEGATIVE' : undeclared identifier
    D:\我的文档\个人开发\cpp\DbyTool\DbyToolDlg.cpp(195) : error C2039: 'AnimateWindow' : is not a member of '`global namespace''
    D:\我的文档\个人开发\cpp\DbyTool\DbyToolDlg.cpp(195) : error C2065: 'AnimateWindow' : undeclared identifier
    D:\我的文档\个人开发\cpp\DbyTool\DbyToolDlg.cpp(231) : error C2065: 'AW_HOR_POSITIVE' : undeclared identifier
      

  2.   

    得在 纯 win32 应用中才能调用, Win32 Project
      

  3.   

    还有,如楼上所说把 stdafx.h 中的
    #define WINVER 0x0400
    改成
    #define WINVER 0x0501
    也可以,不过这意味着只能在 windows2000以上版本运行 2000与XP
      

  4.   

    我加入了
    #ifndef WINVER
    #define  WINVER 0x0501
    #endif
    错误信息如下:Compiling...
    StdAfx.cpp
    NOTE: WINVER has been defined as 0x0500 or greater which enables
    Windows NT 5.0 and Windows 98 features. When these headers were released,
    Windows NT 5.0 beta 1 and Windows 98 beta 2.1 were the current versions.
    For this release when WINVER is defined as 0x0500 or greater, you can only
    build beta or test applications.  To build a retail application,
    set WINVER to 0x0400 or visit http://www.microsoft.com/msdn/sdk
    to see if retail Windows NT 5.0 or Windows 98 headers are available.
    See the SDK release notes for more information.
    Compiling...
    aa.cpp
    F:\Projects\aa\aa.cpp(65) : error C2664: 'AnimateWindow' : cannot convert parameter 1 from 'class CWnd *' to 'struct HWND__ *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    F:\Projects\aa\aa.cpp(66) : error C2664: 'ShowWindow' : cannot convert parameter 1 from 'class CWnd *' to 'struct HWND__ *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    aaDlg.cpp
    Generating Code...
    Error executing cl.exe.aa.exe - 2 error(s), 0 warning(s)
      

  5.   

    调用方法:
    this->AnimateWindow(200,AW_HIDE|AW_BLEND);
    ::AnimateWindow(this->m_hWnd,200,AW_HIDE|AW_BLEND);
      

  6.   

    搞定,^&^
    是放错地方了。
      

  7.   

    // add these lines for win2000 supports
    #define _WIN32_WINNT 0x0500
    #define WINVER 0x0500
      

  8.   

    哦!忘了,我用的是 .net
    在VC6里要手工加的
      

  9.   

    哦!忘了,我用的是 .net
    在VC6里要手工加的
      

  10.   

    呵呵,我也遇到过。高手告诉我:
    BOOL MyAnimateWindow(HWND hWnd, DWORD dwTime, DWORD dwFlags)
    {
        if(!hWnd) return FALSE;#if(WINVER >= 0x0500)
        return AnimateWindow(hWnd, dwTime, dwFlags);
    #else
        // AnimateWindow is in "user32.dll"
        BOOL bRes = FALSE;
        HINSTANCE hIns = LoadLibrary("user32.dll");
        if(hIns)
        {
            BOOL (WINAPI *pProc)(HWND, DWORD, DWORD);
            pProc = (BOOL (WINAPI *)(HWND, DWORD, DWORD))GetProcAddress(hIns, "AnimateWindow");
            if(pProc) 
                bRes = (*pProc)(hWnd, dwTime, dwFlags);
            FreeLibrary(hIns);
        }
        return bRes;
    #endif
    }
    可以啦。
      

  11.   

    上面那位的代码说得很清楚,看看就明白了。
    不明白?就是你当前的环境下的user32.lib中没有AnimateWindow函数,所以就调用user32.dll吧。
    我个人觉得你就用上面的函数吧,全面、有效。