📄 cc.c
字号:
#include<minigui/common.h>#include<minigui/minigui.h>#include<minigui/gdi.h>#include<minigui/window.h>#include<minigui/control.h>#include<minigui/dti.c>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <fcntl.h>#include "tty.h"#include "gprs.h"#define ID_SLEDIT_1 100#define ID_SLEDIT_2 101#define ID_BUTTON_1 102#define ID_BUTTON_2 103#define ID_BUTTON_3 104#define ID_BUTTON_4 105#define ID_BUTTON_5 106#define ID_BUTTON_6 107#define ID_BUTTON_7 108#define ID_BUTTON_8 109#define ID_BUTTON_9 110#define ID_BUTTON_10 111#define ID_BUTTON_11 112#define ID_BUTTON_12 113#define ID_BUTTON_13 114#define ID_BUTTON_go 115#define ID_BUTTON_delete1 116#define ID_BUTTON_delete2 117char buffer[30];char buffer1[300];char buff[300];int len;static int CreateWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam){ HDC hdc;switch (message){ case MSG_CREATE: CreateWindow (CTRL_SLEDIT, "", WS_VISIBLE|ES_LEFT|WS_BORDER, ID_SLEDIT_1, 10,15,100,35, hWnd, 0); CreateWindow (CTRL_SLEDIT, "", WS_VISIBLE|ES_LEFT|WS_BORDER, ID_SLEDIT_2, 10,90,100,35, hWnd, 0); /*case MSG_ERASEBKGND: { printf ("Begin MSG_ERASEBKGND.\n"); hdc=GetClientDC(hWnd); FillBoxWithBitmap(hdc,0,0,320,240,&bmp_at); Rectangle(hdc,0,0,320,240); ReleaseDC (hdc); /*printf ("Begin MSG_ERASEBKGND.\n"); return 0;}*/ CreateWindow (CTRL_BUTTON, "1", WS_CHILD|BS_PUSHBUTTON|BS_CHECKED|WS_VISIBLE, ID_BUTTON_1, 125,15,15,20, hWnd, 0); CreateWindow (CTRL_BUTTON, "2", WS_CHILD|BS_PUSHBUTTON|BS_CHECKED|WS_VISIBLE, ID_BUTTON_2, 140,15,15,20, hWnd, 0); CreateWindow (CTRL_BUTTON, "3", WS_CHILD|BS_PUSHBUTTON|BS_CHECKED|WS_VISIBLE, ID_BUTTON_3, 155,15,15,20, hWnd, 0); CreateWindow (CTRL_BUTTON, "4", WS_CHILD|BS_PUSHBUTTON|BS_CHECKED|WS_VISIBLE, ID_BUTTON_4, 170,15,15,20, hWnd, 0); CreateWindow (CTRL_BUTTON, "5", WS_CHILD|BS_PUSHBUTTON|BS_CHECKED|WS_VISIBLE, ID_BUTTON_5, 185,15,15,20, hWnd, 0); CreateWindow (CTRL_BUTTON, "6", WS_CHILD|BS_PUSHBUTTON|BS_CHECKED|WS_VISIBLE, ID_BUTTON_6, 200,15,15,20, hWnd, 0); CreateWindow (CTRL_BUTTON, "7", WS_CHILD|BS_PUSHBUTTON|BS_CHECKED|WS_VISIBLE, ID_BUTTON_7, 215,15,15,20, hWnd, 0); CreateWindow (CTRL_BUTTON, "8", WS_CHILD|BS_PUSHBUTTON|BS_CHECKED|WS_VISIBLE, ID_BUTTON_8, 230,15,15,20, hWnd, 0); CreateWindow (CTRL_BUTTON, "9", WS_CHILD|BS_PUSHBUTTON|BS_CHECKED|WS_VISIBLE, ID_BUTTON_9, 245,15,15,20, hWnd, 0); CreateWindow (CTRL_BUTTON, "0", WS_CHILD|BS_PUSHBUTTON|BS_CHECKED|WS_VISIBLE, ID_BUTTON_10, 260,15,15,20, hWnd, 0); CreateWindow (CTRL_BUTTON, "A", WS_CHILD|BS_PUSHBUTTON|BS_CHECKED|WS_VISIBLE, ID_BUTTON_11, 125,90,15,20, hWnd, 0); CreateWindow (CTRL_BUTTON, "B", WS_CHILD|BS_PUSHBUTTON|BS_CHECKED|WS_VISIBLE, ID_BUTTON_12, 140,90,15,20, hWnd, 0); CreateWindow (CTRL_BUTTON, "C", WS_CHILD|BS_PUSHBUTTON|BS_CHECKED|WS_VISIBLE, ID_BUTTON_13, 155,90,15,20, hWnd, 0); CreateWindow (CTRL_BUTTON, "go", WS_CHILD|BS_PUSHBUTTON|BS_CHECKED|WS_VISIBLE, ID_BUTTON_go, 200,150,60,40, hWnd, 0); CreateWindow (CTRL_BUTTON, "delete1", WS_CHILD|BS_PUSHBUTTON|BS_CHECKED|WS_VISIBLE, ID_BUTTON_delete1, 125,40,30,30, hWnd, 0); CreateWindow (CTRL_BUTTON, "delete2", WS_CHILD|BS_PUSHBUTTON|BS_CHECKED|WS_VISIBLE, ID_BUTTON_delete2, 125,120,30,30, hWnd, 0); break; case MSG_COMMAND: switch(wParam) { case ID_BUTTON_1: GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer,30); strcpy(buff,"1"); strcat(buffer,buff); printf("%s\n",buffer); SetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer); break; case ID_BUTTON_2: GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer,30); strcpy(buff,"2"); strcat(buffer,buff); printf("%s\n",buffer); SetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer); break; case ID_BUTTON_3: GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer,30); strcpy(buff,"3"); strcat(buffer,buff); printf("%s\n",buffer); SetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer); break; case ID_BUTTON_4: GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer,30); strcpy(buff,"4"); strcat(buffer,buff); printf("%s\n",buffer); SetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer); break; case ID_BUTTON_5: GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer,30); strcpy(buff,"5"); strcat(buffer,buff); printf("%s\n",buffer); SetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer); break; case ID_BUTTON_6: GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer,30); strcpy(buff,"6"); strcat(buffer,buff); printf("%s\n",buffer); SetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer); break; case ID_BUTTON_7: GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer,30); strcpy(buff,"7"); strcat(buffer,buff); printf("%s\n",buffer); SetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer); break; case ID_BUTTON_8: GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer,30); strcpy(buff,"8"); strcat(buffer,buff); printf("%s\n",buffer); SetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer); break; case ID_BUTTON_9: GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer,30); strcpy(buff,"9"); strcat(buffer,buff); printf("%s\n",buffer); SetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer); break; case ID_BUTTON_10: GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer,30); strcpy(buff,"0"); strcat(buffer,buff); printf("%s\n",buffer); SetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer); break; case ID_BUTTON_11: GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_2),buffer1,300); strcpy(buff,"A"); strcat(buffer1,buff); printf("%s\n",buffer1); SetWindowText(GetDlgItem(hWnd,ID_SLEDIT_2),buffer1); break; case ID_BUTTON_12: GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_2),buffer1,300); strcpy(buff,"B"); strcat(buffer1,buff); printf("%s\n",buffer1); SetWindowText(GetDlgItem(hWnd,ID_SLEDIT_2),buffer1); break; case ID_BUTTON_13: GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_2),buffer1,300); strcpy(buff,"C"); strcat(buffer1,buff); printf("%s\n",buffer1); SetWindowText(GetDlgItem(hWnd,ID_SLEDIT_2),buffer1); break; case ID_BUTTON_delete1: GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer,30); len=strlen(buffer); buffer[len-1]='\0'; SetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1),buffer); break; case ID_BUTTON_delete2: GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_2),buffer1,30); len=strlen(buffer1); buffer1[len-1]='\0'; SetWindowText(GetDlgItem(hWnd,ID_SLEDIT_2),buffer1); break; case ID_BUTTON_go: GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_1 ),buffer,30); GetWindowText(GetDlgItem(hWnd,ID_SLEDIT_2 ),buffer1,300); msg_send(buffer, buffer1); //msg_send("13478985211","收到了么?" ); MessageBox(hWnd,"发送成功","消息",MB_OK); tty_end(); UpdateWindow(hWnd,1); break; return 0; } 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 hMainWnd; MAINWINCREATE CreateInfo; CreateInfo.dwStyle = WS_VISIBLE | WS_BORDER | WS_CAPTION; CreateInfo.dwExStyle = WS_EX_NONE; CreateInfo.spCaption = "MINE"; CreateInfo.hMenu =0; CreateInfo.hCursor = GetSystemCursor(0); CreateInfo.hIcon = 0; CreateInfo.MainWindowProc = CreateWinProc; CreateInfo.lx = 0; CreateInfo.ty = 0; CreateInfo.rx = 320; CreateInfo.by = 240; CreateInfo.iBkColor = COLOR_lightwhite; CreateInfo.dwAddData = 0; CreateInfo.dwReserved = 0; CreateInfo.hHosting = HWND_DESKTOP; hMainWnd = CreateMainWindow (&CreateInfo); ShowWindow(hMainWnd, SW_SHOWNORMAL); tty_init(); gprs_init(); while (GetMessage(&Msg, hMainWnd)) { TranslateMessage(&Msg); DispatchMessage(&Msg); } MiniGUIExtCleanUp(); MainWindowThreadCleanup(hMainWnd); MainWindowThreadCleanup (hMainWnd); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -