📄 simplekey.c
字号:
/* ** $Id: simplekey.c,v 1.12 2007-10-25 07:56:45 weiym Exp $**** Listing 9.1**** simplekey.c: Sample program for MiniGUI Programming Guide** Demo of using key input**** Copyright (C) 2004 ~ 2007 Feynman Software.**** License: GPL*/#include <minigui/common.h>#include <minigui/minigui.h>#include <minigui/gdi.h>#include <minigui/window.h>static int SimplekeyWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam){
switch (message) { case MSG_KEYDOWN: printf ("MGS_KEYDOWN: key %d\n", LOWORD(wParam)); break; case MSG_KEYUP: printf ("MGS_KEYUP: key %d\n", LOWORD(wParam)); break; case MSG_CHAR: printf ("MGS_CHAR: char %d\n", wParam); break; case MSG_CLOSE: DestroyAllControls (hWnd); DestroyMainWindow (hWnd); PostQuitMessage (hWnd); return 0; } return DefaultMainWinProc(hWnd, message, wParam, lParam);}int MiniGUIMain (int args, const char* arg[]){ MSG Msg; HWND hMainWnd; MAINWINCREATE CreateInfo;#ifdef _MGRM_PROCESSES JoinLayer(NAME_DEF_LAYER , "simplekey" , 0 , 0);#endif CreateInfo.dwStyle = WS_VISIBLE | WS_BORDER | WS_CAPTION; CreateInfo.dwExStyle = WS_EX_NONE; CreateInfo.spCaption = "demo of using key"; CreateInfo.hMenu = 0; CreateInfo.hCursor = GetSystemCursor(0); CreateInfo.hIcon = 0; CreateInfo.MainWindowProc = SimplekeyWinProc; CreateInfo.lx = 0; CreateInfo.ty = 0; CreateInfo.rx = 320; CreateInfo.by = 240; CreateInfo.iBkColor = COLOR_lightwhite; CreateInfo.dwAddData = 0; CreateInfo.hHosting = HWND_DESKTOP; hMainWnd = CreateMainWindow (&CreateInfo);
ShowWindow(hMainWnd, SW_SHOWNORMAL); if (hMainWnd == HWND_INVALID) return -1; while (GetMessage(&Msg, hMainWnd)) { TranslateMessage(&Msg); DispatchMessage(&Msg); } MainWindowThreadCleanup (hMainWnd); return 0;}#ifndef _LITE_VERSION#include <minigui/dti.c>#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -