aboutsummaryrefslogtreecommitdiff
path: root/WinUtils.h
diff options
context:
space:
mode:
authorRadAd <adamgates84+github@gmail.com>2019-05-24 11:43:35 +1000
committerRadAd <adamgates84+github@gmail.com>2019-05-24 11:43:35 +1000
commitb109b3aa802ba463200eeced0f654f5316549deb (patch)
tree9e75bcc0211de675667d89c33dff868464288296 /WinUtils.h
downloadRadTerminal-b109b3aa802ba463200eeced0f654f5316549deb.tar.gz
RadTerminal-b109b3aa802ba463200eeced0f654f5316549deb.zip
Initial version
Diffstat (limited to 'WinUtils.h')
-rw-r--r--WinUtils.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/WinUtils.h b/WinUtils.h
new file mode 100644
index 0000000..a2b630b
--- /dev/null
+++ b/WinUtils.h
@@ -0,0 +1,36 @@
+#pragma once
+#include <windows.h>
+
+inline BOOL UnadjustWindowRect(
+ LPRECT prc,
+ DWORD dwStyle,
+ BOOL fMenu)
+{
+ RECT rc;
+ SetRectEmpty(&rc);
+ BOOL fRc = AdjustWindowRect(&rc, dwStyle, fMenu);
+ if (fRc) {
+ prc->left -= rc.left;
+ prc->top -= rc.top;
+ prc->right -= rc.right;
+ prc->bottom -= rc.bottom;
+ }
+ return fRc;
+}
+
+inline RECT Rect(POINT p1, POINT p2)
+{
+ return { p1.x, p1.y, p2.x, p2.y };
+}
+
+inline RECT Rect(POINT p1, SIZE s2)
+{
+ return { p1.x, p1.y, p1.x + s2.cx, p1.y + s2.cy };
+}
+
+inline HFONT CreateFont(LPTSTR pFontFace, int iFontHeight, int cWeight)
+{
+ return CreateFont(iFontHeight, 0, 0, 0, cWeight, FALSE, FALSE, FALSE, ANSI_CHARSET,
+ OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
+ DEFAULT_PITCH | FF_DONTCARE, pFontFace);
+}