📄 cwin32window.h
字号:
// CWin32Window.h - Win32 Window Class that makes creating and manipulating
// a window really easy. Copyright(C)2000 David Overton.
#if !defined(__CWin32Window_H_)
#define __CWin32Window_H_
#if !defined(WIN32_LEAN_AND_MEAN)
#define WIN32_LEAN_AND_MEAN
#endif // defined(WIN32_LEAN_AND_MEAN)
class CWin32Window {
private:
protected:
HDC m_hDC;
HWND m_hWnd;
HACCEL m_hAccel;
WNDCLASSEX m_ClassInfo;
public:
CWin32Window();
~CWin32Window();
// Class Functions
LPWNDCLASSEX GetClassInfo();
bool DoRegisterClass();
bool DoUnregisterClass();
// Window Functions
int EnterMessageLoop();
bool Attach(HWND hWnd);
bool FindAndAttach(LPCSTR lpClassName=NULL, LPCSTR lpWndName=NULL);
bool Minimize();
bool Restore();
bool Maximize();
bool Close();
bool Destroy();
bool Refresh();
bool Show();
bool Hide();
bool Create(LPCSTR lpTitle=NULL, int x=CW_USEDEFAULT, int y=CW_USEDEFAULT, int cx=CW_USEDEFAULT, int cy=CW_USEDEFAULT, DWORD dwStyle=WS_OVERLAPPEDWINDOW, DWORD dwStyleEx=0, HWND hWndParent=NULL);
bool Create(LPCSTR lpTitle=NULL, int x=CW_USEDEFAULT, int y=CW_USEDEFAULT, int cx=CW_USEDEFAULT, int cy=CW_USEDEFAULT, DWORD dwStyle=WS_OVERLAPPEDWINDOW, DWORD dwStyleEx=0, CWin32Window* Parent=NULL);
bool IsChildOf(HWND hWndParent);
bool IsChildOf(CWin32Window* Parent);
bool IsMinimized();
bool IsRestored();
bool IsMaximized();
bool IsVisible();
bool SetCaption(LPCSTR lpCaption);
bool GetCaption(LPSTR lpBuffer, int nBufferMax);
int GetCaptionLength();
RECT GetClientRect();
RECT GetWindowRect();
bool SetWindowRect(LPRECT lpRect);
int GetLeft();
int GetTop();
int GetWidth();
int GetHeight();
bool SetWidth(int nWidth);
bool SetHeight(int nHeight);
HWND GetSafeHandle();
HWND GetParentHandle();
HDC GetDC();
bool ReleaseDC();
bool MoveWindow(int X, int Y, int nWidth, int nHeight, bool bRepaint=true);
bool SetWindowPos(HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags);
bool SetParent(CWin32Window* NewParent);
bool SetParent(HWND hWndNewParent);
bool SetForegroundWindow();
bool LockUpdate();
bool UnlockUpdate();
bool FlashWindow(DWORD dwFlags);
// Advanced-ish Window Functions
bool ShowInTaskbar(bool bShow=true);
bool ShowCaption(bool bShow=true);
bool SetAlwaysOnTop(bool bAlwaysOnTop=true);
// Accelerator functions
bool LoadAccelerators(LPCTSTR lpTableName);
bool SetAccelerators(HACCEL hAccel);
bool FreeAccelerators();
HACCEL ReleaseAccelerators();
HACCEL GetAccelerators();
};
#endif // def
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -