📄 window.h
字号:
//
// $Id: window.h,v 1.2 2000/04/20 03:18:24 weiym Exp $
//
// window.h: the head file of window management module.
//
// Copyright (c) 1999, Mr. Wei Yongming.
//
// Create date: 1999.01.14
#ifndef GUI_WINDOW_H
#define GUI_WINDOW_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef int (* WNDPROC)(HWND, int, WPARAM, LPARAM);
typedef int (* KEYMSGHOOK)(HWND, int, WPARAM, LPARAM);
typedef int (* MOUSEMSGHOOK)(HWND, int, WPARAM, LPARAM);
/******************************** Message support ****************************/
// definitions of common messages.
#define MSG_SYNCMSG 0x0000
#define MSG_NULLMSG 0x0000
// Group 1 from 0x0001 to 0x000F, the mouse messages.
#define MSG_FIRSTMOUSEMSG 0x0001
#define MSG_LBUTTONDOWN 0x0001
#define MSG_LBUTTONUP 0x0002
#define MSG_LBUTTONDBLCLK 0x0003
#define MSG_MOUSEMOVE 0x0004
#define MSG_RBUTTONDOWN 0x0005
#define MSG_RBUTTONUP 0x0006
#define MSG_RBUTTONDBLCLK 0x0007
#define MSG_NCMOUSEOFF 0x0007
#define MSG_NCLBUTTONDOWN 0x0008
#define MSG_NCLBUTTONUP 0x0009
#define MSG_NCLBUTTONDBLCLK 0x000A
#define MSG_NCMOUSEMOVE 0x000B
#define MSG_NCRBUTTONDOWN 0x000C
#define MSG_NCRBUTTONUP 0x000D
#define MSG_NCRBUTTONDBLCLK 0x000E
#define MSG_MOUSEMOVEIN 0x000F
#define MSG_LASTMOUSEMSG 0x000F
// Group 2 from 0x0010 to 0x001F, the key messages.
#define MSG_FIRSTKEYMSG 0x0010
#define MSG_KEYDOWN 0x0010
#define MSG_CHAR 0x0011
#define MSG_KEYUP 0x0012
#define MSG_SYSKEYDOWN 0x0013
#define MSG_SYSCHAR 0x0014
#define MSG_SYSKEYUP 0x0015
#define MSG_LASTKEYMSG 0x001F
// Group 3 from 0x0020 to 0x005F, the post-mousekey messages.
#define MSG_FIRSTPOSTMSG 0x0020
#define MSG_SETCURSOR 0x0020
#define HT_UNKNOWN 0x00
#define HT_OUT 0x01
#define HT_MENUBAR 0x02
#define HT_TRANSPARENT 0x03
#define HT_BORDER_TOP 0x04
#define HT_BORDER_BOTTOM 0x05
#define HT_BORDER_LEFT 0x06
#define HT_BORDER_RIGHT 0x07
#define HT_CORNER_TL 0x08
#define HT_CORNER_TR 0x09
#define HT_CORNER_BL 0x0A
#define HT_CORNER_BR 0x0B
#define HT_CLIENT 0x0C
#define SBPOS_LEFTARROW 0x81
#define SBPOS_RIGHTARROW 0x82
#define SBPOS_LEFTSPACE 0x83
#define SBPOS_RIGHTSPACE 0x84
#define SBPOS_UPARROW 0x85
#define SBPOS_DOWNARROW 0x86
#define SBPOS_UPSPACE 0x87
#define SBPOS_DOWNSPACE 0x88
#define SBPOS_THUMB 0x89
#define SBPOS_UNKNOWN 0x80
#define SBPOS_MASK 0x80
#define HT_BORDER 0x11
#define HT_NCLIENT 0x12
#define HT_CAPTION 0x13
#define HT_ICON 0x14
#define HT_CLOSEBUTTON 0x15
#define HT_MAXBUTTON 0x16
#define HT_MINBUTTON 0x17
#define HT_HSCROLL 0x18
#define HT_VSCROLL 0x19
#define HT_NEEDCAPTURE 0x10
#define MSG_NCHITTEST 0x0021 // this is an async message.
#define MSG_HITTEST MSG_NCHITTEST
#define MSG_CHANGESIZE 0x0022
#define MSG_QUERYNCRECT 0x0023
#define MSG_QUERYCLIENTAREA 0x0024
#define MSG_SIZECHANGING 0x0025
#define MSG_SIZECHANGED 0x0026
#define MSG_SETFOCUS 0x0030
#define MSG_KILLFOCUS 0x0031
#define MSG_MOUSEACTIVE 0x0032
#define MSG_ACTIVE 0x0033
#define MSG_ACTIVEMENU 0x0040
#define MSG_DEACTIVEMENU 0x0041
// Scroll bar notifying code
#define SB_LINEUP 0x01
#define SB_LINEDOWN 0x02
#define SB_LINELEFT 0x03
#define SB_LINERIGHT 0x04
#define SB_PAGEUP 0x05
#define SB_PAGEDOWN 0x06
#define SB_PAGELEFT 0x07
#define SB_PAGERIGHT 0x08
#define SB_THUMBPOSITION 0x09
#define SB_THUMBTRACK 0x0A
#define SB_ENDSCROLL 0x0B
#define MSG_HSCROLL 0x0042
#define MSG_VSCROLL 0x0043
#define MSG_NCSETCURSOR 0x0044
#define MSG_LASTPOSTMSG 0x005F
// Group 4 from 0x0060 to 0x009F, the creation messages.
#define MSG_FIRSTCREATEMSG 0x0060
#define MSG_CREATE 0x0060
#define MSG_NCCREATE 0x0061
#define MSG_INITPANES 0x0062
#define MSG_DESTROYPANES 0x0063
#define MSG_DESTROY 0x0064
#define MSG_NCDESTROY 0x0065
#define MSG_CLOSE 0x0066
#define MSG_NCCALCSIZE 0x0067
#define MSG_LASTCREATEMSG 0x009F
// Group 5 from 0x00A0 to 0x00CF, the paint messages.
#define MSG_FIRSTPAINTMSG 0x00A0
#define MSG_SHOWWINDOW 0x00A0
#define MSG_ERASEBKGND 0x00B0 // this is an async message.
#define MSG_PAINT 0x00B1
#define MSG_NCPAINT 0x00B2
#define MSG_NCACTIVATE 0x00B3
#define MSG_SYNCPAINT 0x00B4
#define MSG_ENABLE 0x00C0
#define MSG_LASTPAINTMSG 0x00CF
// Group 6 from 0x00D0 to 0x00EF, the desktop messages.
#define MSG_FIRSTSESSIONMSG 0x00D0
#define MSG_STARTSESSION 0x00D0
#define MSG_QUERYENDSESSION 0x00D1
#define MSG_ENDSESSION 0x00D2
#define MSG_ERASEDESKTOP 0x00E0
#define MSG_PAINTDESKTOP 0x00E1
#define MSG_DT_MOUSEOFF 0x00E1
#define MSG_DT_LBUTTONDOWN 0x00E2
#define MSG_DT_LBUTTONUP 0x00E3
#define MSG_DT_LBUTTONDBLCLK 0x00E4
#define MSG_DT_MOUSEMOVE 0x00E5
#define MSG_DT_RBUTTONDOWN 0x00E6
#define MSG_DT_RBUTTONUP 0x00E7
#define MSG_DT_RBUTTONDBLCLK 0x00E8
#define MSG_DT_KEYOFF 0x00DA
#define MSG_DT_KEYDOWN 0x00EA
#define MSG_DT_CHAR 0x00EB
#define MSG_DT_KEYUP 0x00EC
#define MSG_DT_SYSKEYDOWN 0x00ED
#define MSG_DT_SYSCHAR 0x00EE
#define MSG_DT_SYSKEYUP 0x00EF
#define MSG_LASTSESSIONMSG 0x00EF
// Group 7 from 0x00F0 to 0x010F, the window messages.
#define MSG_FIRSTWINDOWMSG 0x00F0
#define MSG_ADDNEWMAINWIN 0x00F0
#define MSG_REMOVEMAINWIN 0x00F1
#define MSG_MOVETOTOPMOST 0x00F2
#define MSG_SETACTIVEMAIN 0x00F3
#define MSG_GETACTIVEMAIN 0x00F4
#define MSG_SHOWMAINWIN 0x00F5
#define MSG_HIDEMAINWIN 0x00F6
#define MSG_MOVEMAINWIN 0x00F7
#define MSG_SETCAPTURE 0x00F8
#define MSG_GETCAPTURE 0x00F9
#define MSG_ENDTRACKMENU 0x00FA
#define MSG_TRACKPOPUPMENU 0x00FB
#define MSG_CLOSEMENU 0x00FC
#define MSG_SCROLLMAINWIN 0x00FD
#define MSG_CARET_CREATE 0x00FE
#define MSG_CARET_DESTROY 0x00FF
#define MSG_ENABLEMAINWIN 0x0100
#define MSG_ISENABLED 0x0101
#define MSG_SETWINCURSOR 0x0102
#define MSG_LASTWINDOWMSG 0x010F
// Group 8 from 0x0120 to 0x013F, the dialog and control messages.
#define MSG_FIRSTCONTROLMSG 0x0120
#define MSG_COMMAND 0x0120
#define MSG_SYSCOMMAND 0x0121
#define MSG_GETDLGCODE 0x0122
#define MSG_INITDIALOG 0x0123
#define MSG_NEXTDLGCTRL 0x0124
#define MSG_ENTERIDLE 0x0125
#define MSG_DLG_GETDEFID 0x0126
#define MSG_DLG_SETDEFID 0x0127
#define MSG_DLG_REPOSITION 0x0128
#define MSG_GETFONT 0x0130
#define MSG_SETFONT 0x0131
#define MSG_GETTEXTLENGTH 0x0132
#define MSG_GETTEXT 0x0133
#define MSG_SETTEXT 0x0134
#define MSG_LASTCONTROLMSG 0x013F
// Group 9 from 0x0140 to 0x016F, the system messages.
#define MSG_FIRSTSYSTEMMSG 0x0140
#define MSG_QUIT 0x0140
#define MSG_IDLE 0x0142
#define MSG_TIMEOUT 0x0143
#define MSG_TIMER 0x0144
#define MSG_CARETBLINK 0x0145
#define MSG_IME_REGISTER 0x0151
#define MSG_IME_UNREGISTER 0x0152
#define MSG_IME_OPEN 0x0153
#define MSG_IME_CLOSE 0x0154
#define MSG_IME_SETSTATUS 0x0156
#define MSG_IME_GETSTATUS 0x0157
#define IS_ENABLE 1
#define IS_FULLCHAR 2
#define IS_FULLPUNC 3
#define IS_METHOD 4
#define MSG_IME_SETTARGET 0x0158
#define MSG_IME_GETTARGET 0x0159
#define MSG_SHOWMENU 0x0160
#define MSG_HIDEMENU 0x0161
#define MSG_ADDTIMER 0x0162
#define MSG_REMOVETIMER 0x0163
#define MSG_RESETTIMER 0x0164
#define MSG_WINDOWCHANGED 0x0165
#define MSG_BROADCASTMSG 0x0166
#define MSG_REGISTERWNDCLASS 0x0167
#define MSG_UNREGISTERWNDCLASS 0x0168
#define MSG_NEWCTRLINSTANCE 0x0169
#define MSG_REMOVECTRLINSTANCE 0x016A
#define MSG_GETCTRLCLASSINFO 0x016B
#define MSG_CTRLCLASSDATAOP 0x016C
#define CCDOP_GETCCI 0x01
#define CCDOP_SETCCI 0x02
#define MSG_REGISTERKEYHOOK 0x016D
#define MSG_REGISTERMOUSEHOOK 0x016E
#define MSG_UNREGISTERHOOK 0x016F
#define MSG_LASTSYSTEMMSG 0x016F
// Group 10 from 0x0170 to 0x018F, the menu messages
#define MSG_FIRSTMENUMSG 0x0170
#define MSG_INITMENU 0x0170
#define MSG_INITMENUPOPUP 0x0171
#define MSG_MENUSELECT 0x0172
#define MSG_MENUCHAR 0x0173
#define MSG_ENTERMENULOOP 0x0174
#define MSG_EXITMENULOOP 0x0175
#define MSG_CONTEXTMENU 0x0176
#define MSG_NEXTMENU 0x0177
#define MSG_LASTMENUMSG 0x018F
#define MSG_FIRSTUSERMSG 0x0800
#define MSG_USER 0x0800
#define MSG_LASTUSERMSG 0xEFFF
// NOTE:
// Control messages start from 0xF000
#define MSG_FIRSTCTRLMSG 0xF000
// Static Control messages
#define STM_SETICON 0xF170
#define STM_GETICON 0xF171
#define STM_SETIMAGE 0xF172
#define STM_GETIMAGE 0xF173
#define STM_MSGMAX 0xF174
// Static Control notification code
#define STN_CLICKED 0
#define STN_DBLCLK 1
#define STN_ENABLE 2
#define STN_DISABLE 3
// Edit Control messages
#define EM_GETSEL 0xF0B0
#define EM_SETSEL 0xF0B1
#define EM_GETRECT 0xF0B2
#define EM_SETRECT 0xF0B3
#define EM_SETRECTNP 0xF0B4
#define EM_SCROLL 0xF0B5
#define EM_LINESCROLL 0xF0B6
#define EM_SCROLLCARET 0xF0B7
#define EM_GETMODIFY 0xF0B8
#define EM_SETMODIFY 0xF0B9
#define EM_GETLINECOUNT 0xF0BA
#define EM_LINEINDEX 0xF0BB
#define EM_SETHANDLE 0xF0BC
#define EM_GETHANDLE 0xF0BD
#define EM_GETTHUMB 0xF0BE
#define EM_LINELENGTH 0xF0C1
#define EM_REPLACESEL 0xF0C2
#define EM_GETLINE 0xF0C4
#define EM_LIMITTEXT 0xF0C5
#define EM_CANUNDO 0xF0C6
#define EM_UNDO 0xF0C7
#define EM_FMTLINES 0xF0C8
#define EM_LINEFROMCHAR 0xF0C9
#define EM_SETTABSTOPS 0xF0CB
#define EM_SETPASSWORDCHAR 0xF0CC
#define EM_EMPTYUNDOBUFFER 0xF0CD
#define EM_GETFIRSTVISIBLELINE 0xF0CE
#define EM_SETREADONLY 0xF0CF
#define EM_SETWORDBREAKPROC 0xF0D0
#define EM_GETWORDBREAKPROC 0xF0D1
#define EM_GETPASSWORDCHAR 0xF0D2
#define EM_SETMARGINS 0xF0D3
#define EM_GETMARGINS 0xF0D4
#define EM_SETLIMITTEXT EM_LIMITTEXT
#define EM_GETLIMITTEXT 0xF0D5
#define EM_POSFROMCHAR 0xF0D6
#define EM_CHARFROMPOS 0xF0D7
#define EM_SETIMESTATUS 0xF0D8
#define EM_GETIMESTATUS 0xF0D9
// Button Control messages
#define BM_GETCHECK 0xF0F0
#define BM_SETCHECK 0xF0F1
#define BM_GETSTATE 0xF0F2
#define BM_SETSTATE 0xF0F3
#define BM_SETSTYLE 0xF0F4
#define BM_CLICK 0xF0F5
#define BM_GETIMAGE 0xF0F6
#define BM_SETIMAGE 0xF0F7
#define BM_IMAGE_BITMAP 1
#define BM_IMAGE_ICON 2
// Progress Bar messages
#define PBM_SETRANGE 0xF0A0
#define PBM_SETSTEP 0xF0A1
#define PBM_SETPOS 0xF0A2
#define PBM_DELTAPOS 0xF0A3
#define PBM_STEPIT 0xF0A4
// Listbox messages
#define LB_ADDSTRING 0xF180
#define LB_INSERTSTRING 0xF181
#define LB_DELETESTRING 0xF182
#define LB_SELITEMRANGEEX 0xF183
#define LB_RESETCONTENT 0xF184
#define LB_SETSEL 0xF185
#define LB_SETCURSEL 0xF186
#define LB_GETSEL 0xF187
#define LB_GETCURSEL 0xF188
#define LB_GETTEXT 0xF189
#define LB_GETTEXTLEN 0xF18A
#define LB_GETCOUNT 0xF18B
#define LB_SELECTSTRING 0xF18C
#define LB_DIR 0xF18D
#define LB_GETTOPINDEX 0xF18E
#define LB_FINDSTRING 0xF18F
#define LB_GETSELCOUNT 0xF190
#define LB_GETSELITEMS 0xF191
#define LB_SETTABSTOPS 0xF192
#define LB_GETHORIZONTALEXTENT 0xF193
#define LB_SETHORIZONTALEXTENT 0xF194
#define LB_SETCOLUMNWIDTH 0xF195
#define LB_ADDFILE 0xF196
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -