michael@0: // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #ifndef BASE_WIN_UTIL_H__ michael@0: #define BASE_WIN_UTIL_H__ michael@0: michael@0: #include michael@0: #include michael@0: michael@0: #include michael@0: michael@0: #include "base/tracked.h" michael@0: michael@0: namespace win_util { michael@0: michael@0: // NOTE: Keep these in order so callers can do things like michael@0: // "if (GetWinVersion() > WINVERSION_2000) ...". It's OK to change the values, michael@0: // though. michael@0: enum WinVersion { michael@0: WINVERSION_PRE_2000 = 0, // Not supported michael@0: WINVERSION_2000 = 1, michael@0: WINVERSION_XP = 2, michael@0: WINVERSION_SERVER_2003 = 3, michael@0: WINVERSION_VISTA = 4, michael@0: WINVERSION_2008 = 5, michael@0: WINVERSION_WIN7 = 6 michael@0: }; michael@0: michael@0: // Returns the running version of Windows. michael@0: WinVersion GetWinVersion(); michael@0: michael@0: // Returns true if the shift key is currently pressed. michael@0: bool IsShiftPressed(); michael@0: michael@0: // Returns true if the ctrl key is currently pressed. michael@0: bool IsCtrlPressed(); michael@0: michael@0: // Returns true if the alt key is currently pressed. michael@0: bool IsAltPressed(); michael@0: michael@0: // Use the Win32 API FormatMessage() function to generate a string, using michael@0: // Windows's default Message Compiled resources; ignoring the inserts. michael@0: std::wstring FormatMessage(unsigned messageid); michael@0: michael@0: // Uses the last Win32 error to generate a human readable message string. michael@0: std::wstring FormatLastWin32Error(); michael@0: michael@0: } // namespace win_util michael@0: michael@0: #endif // BASE_WIN_UTIL_H__