Files
foobar2000-sdk/libPPUI/win32_utility.h
2021-12-14 00:28:25 -07:00

49 lines
1.3 KiB
C++

#pragma once
#include <atlcomcli.h> // CComPtr
unsigned QueryScreenDPI(HWND wnd = NULL);
unsigned QueryScreenDPI_X(HWND wnd = NULL);
unsigned QueryScreenDPI_Y(HWND wnd = NULL);
SIZE QueryScreenDPIEx(HWND wnd = NULL);
void HeaderControl_SetSortIndicator(HWND header, int column, bool isUp);
POINT GetCursorPos();
HINSTANCE GetThisModuleHandle();
struct WinResourceRef_t {
const void * ptr;
size_t bytes;
} ;
WinResourceRef_t WinLoadResource(HMODULE hMod, const TCHAR * name, const TCHAR * type, WORD wLang = 0);
CComPtr<IStream> WinLoadResourceAsStream(HMODULE hMod, const TCHAR * name, const TCHAR * type, WORD wLang = 0);
UINT GetFontHeight(HFONT font);
UINT GetTextHeight(HDC dc);
LRESULT RelayEraseBkgnd(HWND p_from, HWND p_to, HDC p_dc);
pfc::string8 EscapeTooltipText(const char * text);
class CloseHandleScope {
public:
CloseHandleScope(HANDLE handle) throw() : m_handle(handle) {}
~CloseHandleScope() throw() { CloseHandle(m_handle); }
HANDLE Detach() throw() { return pfc::replace_t(m_handle, INVALID_HANDLE_VALUE); }
HANDLE Get() const throw() { return m_handle; }
void Close() throw() { CloseHandle(Detach()); }
PFC_CLASS_NOT_COPYABLE_EX(CloseHandleScope)
private:
HANDLE m_handle;
};
bool IsMenuNonEmpty(HMENU menu);
void SetDefaultMenuItem(HMENU p_menu, unsigned p_id);
void GetOSVersionString(pfc::string_base & out);
WORD GetOSVersionCode();