📄 个主窗口代输入法的例子, 主窗口用模板的方法建立!! .c
字号:
#include <stdio.h>#include <stdlib.h>#include <minigui/common.h>#include <minigui/minigui.h>#include <minigui/gdi.h>#include <minigui/window.h>#include <minigui/control.h>HWND hwnd;#define IDC_CHARS 110static DLGTEMPLATE DlgYourTaste ={ WS_BORDER | WS_CAPTION, WS_EX_NONE, 0, 0, 370, 280, "Dialog with Edit", 0, 0, 3, NULL, 0};static CTRLDATA CtrlYourTaste[] ={ { "button", WS_VISIBLE | BS_DEFPUSHBUTTON | WS_TABSTOP | WS_GROUP, 70, 220, 70, 28, IDOK, "OK", 0 }, { "button", WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP, 200, 220, 70, 28, IDCANCEL, "Cancel", 0 }, { CTRL_MLEDIT, WS_VISIBLE | WS_BORDER | WS_VSCROLL | ES_BASELINE | ES_AUTOWRAP, 10, 80, 380, 70, IDC_CHARS, "", 0 },};static void my_notif_proc (HWND hwnd, int id, int nc, DWORD add_data){ unsigned char buff [256]; if (id == IDC_CHARS && nc == EN_CHANGE) { GetWindowText (hwnd, buff, 255); }} static int DialogBoxProc2 (HWND hDlg, int message, WPARAM wParam, LPARAM lParam){ static PLOGFONT my_font; HWND hwnd; switch(message){ case MSG_INITDIALOG: my_font = CreateLogFont (NULL, "Arial", "GB2312", FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_SETWIDTH_NORMAL, FONT_SPACING_CHARCELL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_NONE, 30, 0); hwnd = GetDlgItem (hDlg, IDC_CHARS); SetNotificationCallback (hwnd, my_notif_proc); SetWindowFont (hwnd, my_font); SendMessage (hwnd, MSG_KEYDOWN, SCANCODE_INSERT, 0L); return 1; case MSG_COMMAND: switch (wParam) { case IDOK: case IDCANCEL: DestroyMainWindowIndirect (hDlg); break; } break; } return DefaultDialogProc (hDlg, message, wParam, lParam);}int MiniGUIMain (int argc, const char* argv[]){ MSG Msg; HWND input;#ifdef _LITE_VERSION SetDesktopRect(0, 0, 1024, 768);#endif DlgYourTaste.controls = CtrlYourTaste; hwnd = CreateMainWindowIndirect (&DlgYourTaste, HWND_DESKTOP, DialogBoxProc2); if (hwnd == HWND_INVALID){ return -1;}input=GBIMEWindow(hwnd ); while (GetMessage (&Msg, hwnd)) { TranslateMessage (&Msg); DispatchMessage (&Msg); } DestroyMainWindowIndirect (hwnd); return 0;}#ifndef _LITE_VERSION#include <minigui/dti.c>#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -