WTL 9.0的變化 - atlapp.h

來源:互聯網
上載者:User

標籤:class   blog   color   get   os   類   

忽然發現WTL更新到9.0.4140了,便對比了一下 8.1.12085。

先看看atlapp.h中有什麼大的變動。

第61行:

#if defined(_SYSINFOAPI_H_) && defined(NOT_BUILD_WINDOWS_DEPRECATE) && (_WIN32_WINNT >= 0x0501)  #include <VersionHelpers.h>#endif

  XP以及上的系統可以用 VersionHelpers.h中一些更方便的工具函數來判斷windows版本了,例如:IsWindowsXPOrGreater()、IsWindowsXPSP3OrGreater()、IsWindows8OrGreater(),同時VC2013編譯時間也會警告GetVersionEx等API已經過時,所以WTL 9引入了這些新API,並改寫之前WTL版本,如:

inline bool IsVista(){#ifdef _versionhelpers_H_INCLUDED_return ::IsWindowsVistaOrGreater();#else // !_versionhelpers_H_INCLUDED_OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) };BOOL bRet = ::GetVersionEx(&ovi);return ((bRet != FALSE) && (ovi.dwMajorVersion >= 6));#endif // _versionhelpers_H_INCLUDED_}

  

inline bool IsWin7(){#ifdef _versionhelpers_H_INCLUDED_return ::IsWindows7OrGreater();#else // !_versionhelpers_H_INCLUDED_OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) };BOOL bRet = ::GetVersionEx(&ovi);return ((bRet != FALSE) && (ovi.dwMajorVersion == 6) && (ovi.dwMinorVersion >= 1));#endif // _versionhelpers_H_INCLUDED_}

  

第1165行:

// GenericWndClass - generic window class usable for subclassing// Use in dialog templates to specify a placeholder to be subclassed// Specify as a custom control with class name WTL_GenericWindow// Call Rregister() before creating dialog (for example, in WinMain)namespace GenericWndClass{inline LPCTSTR GetName(){return _T("WTL_GenericWindow");}inline ATOM Register(){WNDCLASSEX wc = { sizeof(WNDCLASSEX) };wc.lpfnWndProc = ::DefWindowProc;wc.hInstance = ModuleHelper::GetModuleInstance();wc.hCursor = ::LoadCursor(NULL, IDC_ARROW);wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);wc.lpszClassName = GetName();ATOM atom = ::RegisterClassEx(&wc);ATLASSERT(atom != 0);return atom;}inline BOOL Unregister()   // only needed for DLLs or tmp use{return ::UnregisterClass(GetName(), ModuleHelper::GetModuleInstance());}}; // namespace GenericWndClass

  這是三個新增的函數,看注釋知道,是用於subclass之類的,還沒看到具體該怎樣用。注釋裡WTL作者居然寫錯字了,嘿嘿。

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.