我加入了 #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)
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
#define WINVER 0x0400
改成
#define WINVER 0x0501
也可以,不过这意味着只能在 windows2000以上版本运行 2000与XP
#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)
this->AnimateWindow(200,AW_HIDE|AW_BLEND);
::AnimateWindow(this->m_hWnd,200,AW_HIDE|AW_BLEND);
是放错地方了。
#define _WIN32_WINNT 0x0500
#define WINVER 0x0500
在VC6里要手工加的
在VC6里要手工加的
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
}
可以啦。
不明白?就是你当前的环境下的user32.lib中没有AnimateWindow函数,所以就调用user32.dll吧。
我个人觉得你就用上面的函数吧,全面、有效。