📄 test-gui.c
字号:
#include <stdio.h>
#include <minigui/common.h>
#include <minigui/minigui.h>
#include <minigui/gdi.h>
#include <minigui/window.h>
#include <minigui/control.h>
/*
int DisplayImeProc(HWND hWnd, int nMsg, WPARAM wParam, LPARAM lParam);
int MiniGUIMain (int args, const char* arg[])
{
MSG Msg;
MAINWINCREATE CreateInfo;
HWND hMainWnd;
if(!InitMiniGUIExt())
{
fprintf(stderr, "Can not init mgext library.\n");
return 3;
}
CreateInfo.dwStyle = WS_BORDER;
CreateInfo.dwExStyle = WS_EX_NONE;
CreateInfo.hMenu =(HMENU)NULL;
CreateInfo.hCursor =(HCURSOR)(IDC_ARROW);
CreateInfo.hIcon = GetSmallSystemIcon (IDI_APPLICATION);
CreateInfo.lx=0;
CreateInfo.ty=207;
CreateInfo.rx=320;
CreateInfo.by=240;
CreateInfo.hMenu=(HMENU)NULL;
CreateInfo.MainWindowProc=DisplayImeProc;
CreateInfo.iBkColor=COLOR_lightwhite;
CreateInfo.dwAddData=0;
CreateInfo.hHosting=HWND_DESKTOP;
hMainWnd=CreateMainWindow(&CreateInfo);
if(hMainWnd==HWND_INVALID)
{
fprintf(stderr,"Main Window invalid!\n");
return -1;
}
ShowWindow(hMainWnd,SW_HIDE);
while(GetMessage(&Msg,hMainWnd))
{
DispatchMessage(&Msg);
}
MainWindowThreadCleanup(hMainWnd);
return 0;
}
int DisplayImeProc(HWND hWnd, int nMsg, WPARAM wParam, LPARAM lParam)
{
switch (nMsg)
{
case MSG_CREATE:
{
return 0;
}
}
return DefaultMainWinProc(hWnd, nMsg, wParam, lParam);
}
*/
static int MainWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
switch (message)
{
case MSG_PAINT:
hdc = BeginPaint (hWnd);
TextOut(hdc, 60, 40, "hello world!");
EndPaint(hWnd, hdc);
return 0;
case MSG_CLOSE:
DestroyMainWindow (hWnd);
PostQuitMessage (hWnd);
return 0;
}
return DefaultMainWinProc(hWnd, message, wParam, lParam);
}
int MiniGUIMain (int argc, const char*argv[])
{
MSG Msg;
HWND hWnd;
MAINWINCREATE CreateInfo;
#ifdef _LITE_VERSION
SetDesktopRect(0, 0, 320, 240);
#endif
CreateInfo.dwStyle=WS_VISIBLE| WS_BORDER| WS_CAPTION;
CreateInfo.dwExStyle=WS_EX_NONE;
CreateInfo.spCaption="HelloWorld";
CreateInfo.hMenu=CreateMenu();
CreateInfo.hCursor=GetSystemCursor(0);
CreateInfo.hIcon=0;
CreateInfo.MainWindowProc=MainWinProc;
CreateInfo.lx=80;
CreateInfo.rx=240;
CreateInfo.ty=60;
CreateInfo.by=180;
CreateInfo.iBkColor=COLOR_lightwhite;
CreateInfo.dwAddData=0;
CreateInfo.hHosting=HWND_DESKTOP;
hWnd =CreateMainWindow(&CreateInfo);
if (hWnd == HWND_INVALID)
{
fprintf(stderr,"Main Window invalid!\n");
return -1;
}
ShowWindow(hWnd, SW_SHOWNORMAL);
while (GetMessage(&Msg, hWnd))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
MainWindowThreadCleanup (hWnd);
return 0;
}
#ifndef _LITE_VERSION
#include <minigui/dti.c>
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -