📄 window.h
字号:
* The German keyboard layout. * - KBD_LAYOUT_DELATIN1\n * The German Latin1 keyboard layout. * - KBD_LAYOUT_IT\n * The Italian keyboard layout. * - KBD_LAYOUT_ES\n * The Spanish keyboard layout. * - KBD_LAYOUT_ESCP850\n * The Spanish CP850 keyboard layout. * * \return TRUE for success, otherwise FALSE. * * \sa TranslateMessage, MSG_CHAR, MSG_KEYSYM */BOOL GUIAPI SetKeyboardLayout (const char* kbd_layout);/** * \fn BOOL TranslateMessage (PMSG pMsg) * \brief Translates key down and key up messages to MSG_CHAR * message and post it into the message queue. * * This function translates key down and key up message to an MSG_CHAR * message or some MSG_KEYSYM messages, and send the message(s) to * the window procedure as a notification message. If the message is * not a key message, this function does nothing. * * The behavior of this function is inflected by the current * keyboard layout. The default keyboard layout is US keyboard, but * you can call \a SetKeyboardLayout function to set a different keyboard * layout. * * \param pMsg The pointer of message. * \return A boolean indicates whether the message is a key message. * * \sa SetKeyboardLayout, MSG_CHAR, MSG_KEYSYM */BOOL GUIAPI TranslateMessage (PMSG pMsg);/** * \fn int DispatchMessage (PMSG pMsg) * \brief Dispatches a message to the window's callback procedure. * * This function dispatches the message pointed to by \a pMsg to the * target window's callback procedure. * * \param pMsg The pointer to the message. * \return The return value of the message handler. * * \sa GetMessage * * Example: * * \include getmessage.c */int GUIAPI DispatchMessage (PMSG pMsg);/** * \fn int ThrowAwayMessages (HWND pMainWnd) * \brief Removes all messages in the message queue associated with a window. * * This function removes all messages which are associated with * the specified window \a pMainWnd. * * \param pMainWnd The handle to the window. * \return The number of thrown messages. * * \sa EmptyMessageQueue */int GUIAPI ThrowAwayMessages (HWND pMainWnd);#ifdef _LITE_VERSION/** * \fn BOOL EmptyMessageQueue (HWND hWnd) * \brief Empties a message queue. * * This function empties the message queue of the main window \a hWnd. * * \param hWnd The handle to the main window. * \return TRUE on all success, FALSE on error. * * \note Only defined for MiniGUI-Lite. * * \sa ThrowAwayMessages */BOOL GUIAPI EmptyMessageQueue (HWND hWnd);#endif#ifdef _MSG_STRING/** * \fn const char* GUIAPI Message2Str (int message) * \brief Translates a message identifier to the message string. * * This function returns the message string of the message identifier \a message. * E.g. this function will return the string of "MSG_CHAR" for MSG_CHAR message. * * \param message The message identifier. * \return The message string. * * \note Only defined for _MSG_STRING. * * \sa PrintMessage */const char* GUIAPI Message2Str (int message);/** * \fn void GUIAPI PrintMessage (FILE* fp, HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) * \brief Prints a message in readable string form to a stdio stream. * * This function prints the message specified by (\a iMsg, \a wParam, \a lParam) * in readable string form to the stdio stream \a fp. * * \param fp The pointer to the FILE object. * \param hWnd The target window of the message. * \param iMsg The message identifier. * \param wParam The first parameter of the message. * \param lParam The second parameter of the message. * * \sa Message2Str */void GUIAPI PrintMessage (FILE* fp, HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam);#endif /** @} end of msg_pass_fns */ /** * \defgroup msg_hook_fns Message or event hook functions * @{ */#define HOOK_GOON 0#define HOOK_STOP 1/** * Type of message hook function. */typedef int (* MSGHOOK)(void* context, HWND dst_wnd, int msg, WPARAM wparam, LPARAM lparam);/** * Structure defines a message hook. */typedef struct _HOOKINFO{ /** the context which will be passed to the hook function. */ void* context; /** the pointer to the hook function. */ MSGHOOK hook;} HOOKINFO;/** * \fn MSGHOOK GUIAPI RegisterKeyMsgHook (void* context, MSGHOOK hook) * \brief Registers a key message hook. * * This function registers a key message hook pointed to by \a hook. * * When the desktop receives a key message, it will send it to the hook first, * and passes the \a context value to the hook as the first argument. * * \param context The context value will be passed to the hook. * \param hook The hook. This function will unregister the old hook if hook is NULL. * \return The old hook. * * \sa UnregisterHook, KEYMSGHOOK */MSGHOOK GUIAPI RegisterKeyMsgHook (void* context, MSGHOOK hook);/** * \fn MSGHOOK GUIAPI RegisterMouseMsgHook (void* context, MSGHOOK hook) * \brief Registers a mouse message hook. * * This function registers a mouse message hook pointed to by \a hook. * * When the desktop receives a mouse message, it will send it to the hook first, * and passes the \a context value to the hook as the first argument. * * \param context The context value will be passed to the hook. * \param hook The hook. This function will unregister the old hook if hook is NULL. * \return The old hook. * * \sa UnregisterHook, KEYMSGHOOK */MSGHOOK GUIAPI RegisterMouseMsgHook (void* context, MSGHOOK hook);#ifdef _LITE_VERSION/** * \var typedef int (* SRVEVTHOOK) (PMSG pMsg) * \brief The type of the event hook. * * You can call \a SetServerEventHook to set an event hook * in the server of the MiniGUI-Lite. * * If the event hook returns HOOK_GOON, \a mginit will continue to * handle the event, and send it to the active client. * If the hook returns HOOK_STOP, \a mginit will cancel normal handling. * * \sa SetServerEventHook */typedef int (* SRVEVTHOOK) (PMSG pMsg);/** * \fn void GUIAPI SetServerEventHook (SRVEVTHOOK SrvEvtHook) * \brief Sets an event hook in the server of MiniGUI-Lite. * * This function sets the event hook as \a SrvEvtHook in the server, * i.e. mginit, of MiniGUI-Lite. * * \param SrvEvtHook The pointer to the hook, NULL to cancel the hook. * * \note Only defined for MiniGUI-Lite, and only can be used by the server. * * \sa SRVEVTHOOK */SRVEVTHOOK GUIAPI SetServerEventHook (SRVEVTHOOK SrvEvtHook);#endif /** @} end of msg_hook_fns */ /** @} end of msg_fns */ /** @} end of fns */ /** * \defgroup styles Window styles * @{ *//** * \def WS_NONE * \brief None style. */#define WS_NONE 0x00000000L#define WS_OVERLAPPED 0x00000000L/** * \def WS_ABSSCRPOS * \brief Create a main window whose position is based on absolute screen coordinates. */#define WS_ABSSCRPOS 0x80000000L/** * \def WS_CHILD * \brief Indicates the window is a child. */#define WS_CHILD 0x40000000L/* Clipping styles -- not supported so far *//** * \def WS_VISIBLE * \brief Creates a window initially visible. */#define WS_VISIBLE 0x08000000L/** * \def WS_DISABLED * \brief Creates a window initially disabled. */#define WS_DISABLED 0x04000000L/* Main window states -- not supported so far */#define WS_MINIMIZE 0x02000000L#define WS_MAXIMIZE 0x01000000L/** * \def WS_CAPTION * \brief Creates a main window with caption. */#define WS_CAPTION 0x20000000L/** * \def WS_SYSMENU * \brief Creates a main window with system menu. */#define WS_SYSMENU 0x10000000L#define WS_DLGFRAME 0x00800000L/** * \def WS_BORDER * \brief Creates a window with border. */#define WS_BORDER 0x00400000L/** * \def WS_THICKFRAME * \brief Creates a window with thick frame. */#define WS_THICKFRAME 0x00200000L/** * \def WS_THINFRAME * \brief Creates a window with thin frame. */#define WS_THINFRAME 0x00100000L/** * \def WS_VSCROLL * \brief Creates a window with vertical scroll bar. */#define WS_VSCROLL 0x00080000L/** * \def WS_HSCROLL * \brief Creates a window with horizontal scroll bar. */#define WS_HSCROLL 0x00040000L/** * \def WS_MINIMIZEBOX * \brief Creates a window with minimizing box on caption. */#define WS_MINIMIZEBOX 0x00020000L/** * \def WS_MAXIMIZEBOX * \brief Creates a window with maximizing box on caption. */#define WS_MAXIMIZEBOX 0x00010000L/** * \def WS_GROUP * \brief Indicates the control is the leader of a group. */#define WS_GROUP 0x00020000L/** * \def WS_TABSTOP * \brief Indicates the user can set the input focus to the control by using Tab key. */#define WS_TABSTOP 0x00010000L/** * \def WS_EX_NONE * \brief None extended window style. */#define WS_EX_NONE 0x00000000L /* supported *//** * \def WS_EX_USEPRIVATECDC * \brief The window has its own private client device context. * * \sa CreatePrivateClientDC */#define WS_EX_USEPRIVATECDC 0x00000002L /* supported */#define WS_EX_NOPARENTNOTIFY 0x00000004L/** * \def WS_EX_TOPMOST * \brief The main window is a topmost (always on top) window. */#define WS_EX_TOPMOST 0x00000008L /* supported *//** * \def WS_EX_TRANSPARENT * \brief The window is transparent. * \note This style is only implemented for control. */#define WS_EX_TRANSPARENT 0x00000020L/** * \def WS_EX_TOOLWINDOW * \brief The main window is a tool window, which can not gain the input focus. */#define WS_EX_TOOLWINDOW 0x00000080L /* supported *//** * \def WS_EX_USEPARENTFONT * \brief The window uses the default font of its parent. */#define WS_EX_USEPARENTFONT 0x00000100L /* supported */#define WS_EX_CONTEXTHELP 0x00000400L/** * \def WS_EX_USEPARENTCURSOR * \brief The window uses the default cursor of its parent. */#define WS_EX_USEPARENTCURSOR 0x00000800L /* supported */#define WS_EX_RIGHT 0x00001000L#define WS_EX_LEFT 0x00000000L#define WS_EX_RTLREADING 0x00002000L#define WS_EX_LTRREADING 0x00000000L#define WS_EX_LEFTSCROLLBAR 0x00004000L#define WS_EX_RIGHTSCROLLBAR 0x00000000L#define WS_EX_CONTROLPARENT 0x00010000L#define WS_EX_STATICEDGE 0x00020000L#define WS_EX_APPWINDOW 0x00040000L/* Obsolete style. */#define WS_EX_IMECOMPOSE 0x10000000L/** * \def WS_EX_NOCLOSEBOX * \brief The main window has no closing box on its caption. */#define WS_EX_NOCLOSEBOX 0x20000000L /* supported *//** * \def WS_EX_CTRLASMAINWIN * \brief The control can be displayed out of the main window which contains the control. */#define WS_EX_CTRLASMAINWIN 0x40000000L /* supported */ /** @} end of styles */ /** * \addtogroup fns Functions * @{ */ /** * \defgroup window_fns Windowing functions * @{ */ /** * \defgroup window_create_fns Window creating/destroying * @{ *//** * \var typedef int (* WNDPROC)(HWND, int, WPARAM, LPARAM) * \brief Type of the window callback procedure. */typedef int (* WNDPROC)(HWND, int, WPARAM, LPARAM);#define HWND_DESKTOP 0#define HWND_INVALID 0xFFFFFFFF/** * Structure defines a main window. */typedef struct _MAINWINCREATE{ /** the style of the main window */ DWORD dwStyle; /** the extended style of the main window */ DWORD dwExStyle; /** the caption of the main window */ const char* spCaption; /** the handle to the menu of the main window */ HMENU hMenu; /** the handle to the cursor of the main window */ HCURSOR hCursor; /** the handle to the icon of the main window */ HICON hIcon; /** the hosting main window */ HWND hHosting; /** the window callback procedure */ int (*MainWindowProc)(HWND, int, WPARAM, LPARAM); /** the position of the main window in the screen coordinates */ int lx,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -