summaryrefslogtreecommitdiff
path: root/windows.go
diff options
context:
space:
mode:
Diffstat (limited to 'windows.go')
-rw-r--r--windows.go64
1 files changed, 63 insertions, 1 deletions
diff --git a/windows.go b/windows.go
index 5cfa53d..bf840fb 100644
--- a/windows.go
+++ b/windows.go
@@ -6,6 +6,37 @@ import (
"unsafe"
)
+// Window styles.
+const (
+ WS_BORDER = 0x00800000
+ WS_CAPTION = 0x00C00000
+ WS_CHILD = 0x40000000
+ WS_CHILDWINDOW = 0x40000000
+ WS_CLIPCHILDREN = 0x02000000
+ WS_CLIPSIBLINGS = 0x04000000
+ WS_DISABLED = 0x08000000
+ WS_DLGFRAME = 0x00400000
+ WS_GROUP = 0x00020000
+ WS_HSCROLL = 0x00100000
+ WS_ICONIC = 0x20000000
+ WS_MAXIMIZE = 0x01000000
+ WS_MAXIMIZEBOX = 0x00010000
+ WS_MINIMIZE = 0x20000000
+ WS_MINIMIZEBOX = 0x00020000
+ WS_OVERLAPPED = 0x00000000
+ WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX)
+ WS_POPUP = 0x80000000
+ WS_POPUPWINDOW = (WS_POPUP | WS_BORDER | WS_SYSMENU)
+ WS_SIZEBOX = 0x00040000
+ WS_SYSMENU = 0x00080000
+ WS_TABSTOP = 0x00010000
+ WS_THICKFRAME = 0x00040000
+ WS_TILED = 0x00000000
+ WS_TILEDWINDOW = (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX)
+ WS_VISIBLE = 0x10000000
+ WS_VSCROLL = 0x00200000
+)
+
// Extended window styles.
const (
WS_EX_ACCEPTFILES = 0x00000010
@@ -36,7 +67,12 @@ const (
WS_EX_WINDOWEDGE = 0x00000100
)
-// TODO CW_USEDEFAULT
+// bizarrely, this value is given on the page for CreateMDIWindow, but not CreateWindow or CreateWindowEx
+// I do it this way because Go won't let me shove the exact value into an int
+var (
+ _uCW_USEDEFAULT uint = 0x80000000
+ CW_USEDEFAULT = int(_uCW_USEDEFAULT)
+)
// GetSysColor values. These can be cast to HBRUSH (after adding 1) for WNDCLASS as well.
const (
@@ -78,8 +114,26 @@ const (
COLOR_WINDOWTEXT = 8
)
+// ShowWindow settings.
+const (
+ SW_FORCEMINIMIZE = 11
+ SW_HIDE = 0
+ SW_MAXIMIZE = 3
+ SW_MINIMIZE = 6
+ SW_RESTORE = 9
+ SW_SHOW = 5
+ SW_SHOWDEFAULT = 10
+ SW_SHOWMAXIMIZED = 3
+ SW_SHOWMINIMIZED = 2
+ SW_SHOWMINNOACTIVE = 7
+ SW_SHOWNA = 8
+ SW_SHOWNOACTIVATE = 4
+ SW_SHOWNORMAL = 1
+)
+
var (
createWindowEx = user32.NewProc("CreateWindowExW")
+ showWindow = user32.NewProc("ShowWindow")
)
// TODO use lpParam
@@ -102,3 +156,11 @@ func CreateWindowEx(dwExStyle uint32, lpClassName string, lpWindowName string, d
}
return HWND(r1), nil
}
+
+// TODO figure out how to handle errors
+func ShowWindow(hWnd HWND, nCmdShow int) (previouslyVisible bool, err error) {
+ r1, _, _ := showWindow.Call(
+ uintptr(hWnd),
+ uintptr(nCmdShow))
+ return r1 != 0, nil
+}