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

📄 speed_watch.c

📁 用minigui编写的嵌入式用户界面
💻 C
字号:
/* ** $Id: SeepWatchPorc.c,v 1.35 2006/05/10 09:51:33 xwyan Exp $**** Listing 2.1**** SeepWatchPorc.c: Sample program for MiniGUI Programming Guide**      The first MiniGUI application.**** Copyright (C) 2004 ~ 2006 Feynman Software.**** License: GPL*/#include <stdio.h>#include <string.h>#include <minigui/common.h>#include <minigui/minigui.h>#include <minigui/gdi.h>#include <minigui/window.h>#include <minigui/mywindows.h>static BITMAP s_bmp, p_bmp;static int SeepWatchPorc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam){	static int i = -18;	HDC hdc;    switch (message) {		case MSG_ERASEBKGND:			{				HDC hdc = (HDC)wParam;				const RECT* clip = (const RECT*)lParam;				BOOL fGetDC = FALSE;				RECT rcTemp;				if(hdc == 0)				{					hdc = GetClientDC(hWnd);					fGetDC = TRUE;				}				if(clip)				{					rcTemp = *clip;					ScreenToClient(hWnd, &rcTemp.left, &rcTemp.top);					ScreenToClient(hWnd, &rcTemp.right, &rcTemp.bottom);					IncludeClipRect(hdc, &rcTemp);				}				FillBoxWithBitmap(hdc, 0, 0, 0, 0, &s_bmp);				if(fGetDC)					  ReleaseDC(hdc);				 return 0;			}        case MSG_CREATE:					SetTimer (hWnd, 100, 20);			break;				case MSG_TIMER:			{				RECT rect;				rect.top = 50;				rect.bottom = 430;				rect.left = 100;				rect. right = 540;		//		InvalidateRect(hWnd, &rect, TRUE);				InvalidateRect(hWnd, NULL, TRUE);				//i = (i+1)%200;				//i > 200 ? i = -18: i++;				if(i > 200)					i = -18;				else 					i += 3;			}			break;        case MSG_PAINT:			 hdc = BeginPaint(hWnd);				RotateBitmap(hdc, &p_bmp, 140, 160, i*64);			 EndPaint(hWnd, hdc);			return 0;        case MSG_CLOSE:			UnloadBitmap(&s_bmp);			UnloadBitmap(&p_bmp);			KillTimer (hWnd, 100);            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;#ifdef _MGRM_PROCESSES    JoinLayer(NAME_DEF_LAYER , "SeepWatch" , 0 , 0);#endif		if(LoadBitmapFromFile(HDC_SCREEN, &s_bmp,"speed_watch.png"))			printf("Load picture speed_watch.png faild !\n");				if(LoadBitmapFromFile(HDC_SCREEN, &p_bmp,"speed_opinter.png"))			printf("Load picture speed_opinter.png faild !\n");    CreateInfo.dwStyle = WS_VISIBLE | WS_BORDER | WS_CAPTION;    CreateInfo.dwExStyle = WS_EX_NONE;    CreateInfo.spCaption = "SPEED WATCH!";    CreateInfo.hMenu = 0;    CreateInfo.hCursor = GetSystemCursor(0);    CreateInfo.hIcon = 0;    CreateInfo.MainWindowProc = SeepWatchPorc;    CreateInfo.lx = 0;    CreateInfo.ty = 0;    CreateInfo.rx = g_rcScr.right;    CreateInfo.by = g_rcScr.bottom;    CreateInfo.iBkColor =0xffff;    CreateInfo.dwAddData = 0;    CreateInfo.hHosting = HWND_DESKTOP;        hMainWnd = CreateMainWindow (&CreateInfo);        if (hMainWnd == HWND_INVALID)        return -1;    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 + -