⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sedit.c

📁 miniGUI编程源码
💻 C
字号:
#include <minigui/common.h>#include <minigui/minigui.h>#include <minigui/gdi.h>#include <minigui/window.h>#include <minigui/control.h>HWND hMainWnd;static int  WinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam){   HDC  hdc;    static char str_buf[1000];    static int  no;    static int  y;    static int  char_w, char_h;    switch(message)    {  case MSG_CREATE:          CreateCaret(hWnd, NULL, 2, GetSysCharHeight());			// create the caret is 2(width)          SetCaretBlinkTime(hWnd, 500);          char_w = GetSysCharWidth();          char_h = GetSysCharHeight();          sprintf(str_buf, "");          no = 0;          y = 0;          break;           case MSG_PAINT:	  hdc = BeginPaint(hWnd);	  TextOut(hdc, 0, y, str_buf);	  EndPaint(hWnd, hdc);          SetCaretPos(hWnd, 0,0);	  break;       case MSG_SETFOCUS:          ShowCaret(hWnd);          break;       case MSG_KILLFOCUS:          HideCaret(hWnd);          break;       case MSG_CLOSE:          DestroyCaret(hWnd);				// destroy the caret	  DestroyMainWindow(hWnd);	  PostQuitMessage(hWnd);	  break;       case MSG_CHAR:          if(wParam==127)          {   if(no>0)              {  no--;                 str_buf[no] = ' ';              }          }          else          {   str_buf[no++] = wParam;              str_buf[no] = '\0';          }          if( ((no%68) == 0) ||              (wParam == 0x0D )            )          {   if(no>0)              {   y = y + char_h;                  no = 0;                  sprintf(str_buf, "");              }          }          hdc = BeginPaint(hWnd);          TextOut(hdc, 0, y, str_buf);          EndPaint(hWnd, hdc);          SetCaretPos(hWnd, no * char_w, y);          break;       default:	  return(DefaultMainWinProc(hWnd, message, wParam, lParam));    }    return(0);}int InitMainWindow(void){   MAINWINCREATE  window_info;    window_info.dwStyle = WS_VISIBLE | WS_BORDER | WS_CAPTION;    window_info.dwExStyle = WS_EX_IMECOMPOSE;    window_info.spCaption = "Please input the key";    window_info.hMenu = 0;    window_info.hCursor = GetSystemCursor(0);    window_info.hIcon = 0;    window_info.MainWindowProc = WinProc;    window_info.lx = 50;    window_info.ty = 20;    window_info.rx = 590;    window_info.by = 430;    window_info.iBkColor = COLOR_lightwhite;    window_info.dwAddData = 0;    window_info.hHosting = HWND_DESKTOP;         hMainWnd = CreateMainWindow (&window_info);    if (hMainWnd == HWND_INVALID) return(0);      else  return(1);}int  MiniGUIMain(int argc, const char *argv[]){   MSG Msg;#ifdef _LITE_VERSION    SetDesktopRect(0,0, 800,600);#endif    InitMainWindow();    ShowWindow(hMainWnd, SW_SHOWNORMAL);    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 + -