Added static controls and added a static label to the example window.

This commit is contained in:
Pietro Gagliardi 2014-02-10 17:02:54 -05:00
parent 4d674ebd3d
commit 2231c33954
2 changed files with 68 additions and 0 deletions

11
main.go
View File

@ -25,6 +25,7 @@ const (
IDC_FIXCOMBO IDC_FIXCOMBO
IDC_EDIT IDC_EDIT
IDC_LIST IDC_LIST
IDC_LABEL
) )
var varCombo, fixCombo, edit, list HWND var varCombo, fixCombo, edit, list HWND
@ -221,6 +222,16 @@ func main() {
// TODO check actual return value as THAT indicates an error // TODO check actual return value as THAT indicates an error
} }
_, err = CreateWindowEx(
0,
"STATIC", "Label",
SS_NOPREFIX | controlStyle,
140, 80, 100, 20,
hwnd, HMENU(IDC_FIXCOMBO), hInstance, NULL)
if err != nil {
fatalf("error creating label: %v", err)
}
_, err = ShowWindow(hwnd, nCmdShow) _, err = ShowWindow(hwnd, nCmdShow)
if err != nil { if err != nil {
fatalf("error showing window: %v", err) fatalf("error showing window: %v", err)

57
statics.go Normal file
View File

@ -0,0 +1,57 @@
// 10 february 2014
package main
import (
// "syscall"
// "unsafe"
)
// Static control styles.
const (
// from winuser.h
SS_LEFT = 0x00000000
SS_CENTER = 0x00000001
SS_RIGHT = 0x00000002
SS_ICON = 0x00000003
SS_BLACKRECT = 0x00000004
SS_GRAYRECT = 0x00000005
SS_WHITERECT = 0x00000006
SS_BLACKFRAME = 0x00000007
SS_GRAYFRAME = 0x00000008
SS_WHITEFRAME = 0x00000009
SS_USERITEM = 0x0000000A
SS_SIMPLE = 0x0000000B
SS_LEFTNOWORDWRAP = 0x0000000C
SS_OWNERDRAW = 0x0000000D
SS_BITMAP = 0x0000000E
SS_ENHMETAFILE = 0x0000000F
SS_ETCHEDHORZ = 0x00000010
SS_ETCHEDVERT = 0x00000011
SS_ETCHEDFRAME = 0x00000012
SS_TYPEMASK = 0x0000001F
SS_REALSIZECONTROL = 0x00000040
SS_NOPREFIX = 0x00000080
SS_NOTIFY = 0x00000100
SS_CENTERIMAGE = 0x00000200
SS_RIGHTJUST = 0x00000400
SS_REALSIZEIMAGE = 0x00000800
SS_SUNKEN = 0x00001000
SS_EDITCONTROL = 0x00002000
SS_ENDELLIPSIS = 0x00004000
SS_PATHELLIPSIS = 0x00008000
SS_WORDELLIPSIS = 0x0000C000
SS_ELLIPSISMASK = 0x0000C000
)
// Static control messages and WM_COMMAND notifications.
const (
// from winuser.h
STM_SETICON = 0x0170
STM_GETICON = 0x0171
STM_SETIMAGE = 0x0172
STM_GETIMAGE = 0x0173
STN_CLICKED = 0
STN_DBLCLK = 1
STN_ENABLE = 2
STN_DISABLE = 3
)