📄 animation.c
字号:
/* ** $Id: animation.c,v 1.5.6.1 2006/06/15 10:20:10 xwyan Exp $**** Listing 36.1**** animation.c: Sample program for MiniGUI Programming Guide** Usage of ANIMATION control and GIF89a loader.**** Copyright (C) 2004 ~ 2006 Feynman Software.**** License: GPL*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <minigui/common.h>#include <minigui/minigui.h>#include <minigui/gdi.h>#include <minigui/window.h>#include <minigui/control.h>#include <minigui/mgext.h>static const char* filename = "banner.gif";static ANIMATION* anim = NULL;static int AnimationWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam){ switch (message) { case MSG_CREATE: { anim = CreateAnimationFromGIF89aFile (HDC_SCREEN, filename); if (anim == NULL) return 1; SetWindowAdditionalData (hWnd, (DWORD) anim); CreateWindowEx (CTRL_ANIMATION, "", WS_VISIBLE | ANS_AUTOLOOP | ANS_SCALED, WS_EX_TRANSPARENT, 100, 10, 10, 150, 150, hWnd, (DWORD)anim); SendMessage (GetDlgItem (hWnd, 100), ANM_STARTPLAY, 0, 0); CreateWindowEx (CTRL_ANIMATION, "", WS_VISIBLE | ANS_AUTOLOOP | ANS_FITTOANI, WS_EX_TRANSPARENT, 200, 10, 160, 700, 400, hWnd, (DWORD)NULL); break; } case MSG_LBUTTONDOWN: SendMessage (GetDlgItem (hWnd, 200), ANM_SETANIMATION, 0, (LPARAM)anim); SendMessage (GetDlgItem (hWnd, 200), ANM_STARTPLAY, 0, 0); break; case MSG_DESTROY: DestroyAnimation ((ANIMATION*)GetWindowAdditionalData (hWnd), TRUE); DestroyAllControls (hWnd); 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; if (argc >= 2) filename = argv[1];#ifdef _LITE_VERSION SetDesktopRect(0, 0, 1024, 768);#endif if (!InitMiniGUIExt()) { return 1; } CreateInfo.dwStyle = WS_CAPTION | WS_BORDER | WS_VISIBLE; CreateInfo.dwExStyle = WS_EX_NONE; CreateInfo.spCaption = "Animation Control" ; CreateInfo.hMenu = 0; CreateInfo.hCursor = GetSystemCursor (IDC_ARROW); CreateInfo.hIcon = 0; CreateInfo.MainWindowProc = AnimationWinProc; CreateInfo.lx = 0; CreateInfo.ty = 0; CreateInfo.rx = GetGDCapability(HDC_SCREEN, GDCAP_HPIXEL); CreateInfo.by = GetGDCapability(HDC_SCREEN, GDCAP_VPIXEL); CreateInfo.iBkColor = GetWindowElementColor (BKC_CONTROL_DEF); CreateInfo.dwAddData = 0; CreateInfo.dwReserved = 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); MiniGUIExtCleanUp (); return 0;}#ifndef _LITE_VERSION#include <minigui/dti.c>#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -