?? login.c
字號(hào):
/***************************************************************************** 文件名:Login.C* 功能:MiniGUI應(yīng)用例子。* 使用MiniGUI的靜態(tài)框、按鈕和編輯框控件,實(shí)現(xiàn)一個(gè)Login系統(tǒng)登錄對(duì)話框。 * 說(shuō)明:使用MiniGUI for uC/OS-II,使用ADS 1.2編譯器。****************************************************************************//* 包含MiniGUI的配置頭文件(編譯配置選項(xiàng)) */#include "MiniGUI_config.h"/* 包含MiniGUI頭文件 */#include "common.h"#include "minigui.h"#include "gdi.h"#include "window.h"#include "control.h"#include <string.h>HWND hMainWnd;#define IDC_SLOGIN 300#define IDC_EUSER 401#define IDC_EPASS 402#define IDC_TEMP1 500#define IDC_VOLTL 501// 定義對(duì)話框static DLGTEMPLATE MyDlg ={ WS_BORDER | WS_CAPTION, WS_EX_NONE, 2, 50, 235, 190, "uC/OS操作系統(tǒng)課程設(shè)計(jì)", 0, 0, 6, NULL, 0 };// 定義對(duì)話框中的控件static CTRLDATA CtrlInitData[] = { { "static", WS_VISIBLE | SS_SIMPLE, 40,10, 200, 16, IDC_SLOGIN, "請(qǐng)選擇測(cè)量對(duì)象:", 0, WS_EX_NONE }, { "edit", WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 70,40, 140,25, IDC_EUSER, "", 0, WS_EX_NONE }, { "edit", WS_CHILD | WS_VISIBLE | WS_BORDER | ES_PASSWORD | WS_TABSTOP, 70,80, 140,25, IDC_EPASS, "", 0, WS_EX_NONE }, { "button", WS_VISIBLE | WS_TABSTOP | BS_DEFPUSHBUTTON, 80,120, 80,25, IDOK, "退出", 0, WS_EX_NONE }, { "button", WS_VISIBLE | WS_TABSTOP | BS_DEFPUSHBUTTON, 7,40, 55,25, IDC_TEMP1, "溫度", 0, WS_EX_NONE }, { "button", WS_VISIBLE | WS_TABSTOP | BS_DEFPUSHBUTTON, 7,80, 55,25, IDC_VOLTL, "電壓", 0, WS_EX_NONE },};static int MyDlgProc(HWND hDlg, int message, WPARAM wParam, LPARAM lParam){ switch(message) { case MSG_INITDIALOG: return(1); case MSG_COMMAND: switch(LOWORD(wParam)) { case IDC_TEMP1: case IDC_VOLTL: case IDOK: case MSG_CLOSE: DestroyAllCotronls(hDlg); DestroyMainWindowIndirect(hDlg); PostQuitMessage(hDlg); break; default: break; } break; default: break; } return(DefaultDialogProc(hDlg, message, wParam, lParam));}static void LoginBox(HWND hWnd){ MyDlg.controls = CtrlInitData; DialogBoxIndirectParam(&MyDlg, hWnd, MyDlgProc, 0L);}int InitMainWindow(void){ MAINWINCREATE window_info; window_info.dwStyle = WS_VISIBLE | WS_BORDER | WS_CAPTION; window_info.dwExStyle = WS_EX_NONE; window_info.spCaption = "MiniGUI"; window_info.hMenu = 0; window_info.hCursor = GetSystemCursor(0); window_info.hIcon = 0; window_info.MainWindowProc = WinProc; window_info.lx = 2; window_info.ty = 50; window_info.rx = 238; window_info.by = 200; 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 LoginBox(HWND_DESKTOP); InitMainWindow(); ShowWindow(hMainWnd, SW_SHOWNORMAL); while (GetMessage(&Msg, hMainWnd)) { TranslateMessage(&Msg); DispatchMessage(&Msg); } MainWindowThreadCleanup (hMainWnd); return(0);}#ifndef _LITE_VERSION #include "dti.c"#endif
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -