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

📄 animation.c

📁 这是一个MiniGUI的开发例子库 具有各种典型控件实现的源代码
💻 C
字号:
/* ** $Id: animation.c,v 1.2 2004/08/01 09:43:19 weiym Exp $**** Listing xx.x**** animation.c: Sample program for MiniGUI Programming Guide**      Usage of ANIMATION control and GIF89a loader.**** Copyright (C) 2004 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 int AnimationWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam){    switch (message) {    case MSG_CREATE:    {        ANIMATION* anim = CreateAnimationFromGIF89aFile (HDC_SCREEN, "banner.gif");        if (anim == NULL)            return 1;        SetWindowAdditionalData (hWnd, (DWORD) anim);        CreateWindow (CTRL_ANIMATION,                           "",                           WS_VISIBLE | ANS_AUTOLOOP,                           100,                           10, 10, 300, 200, hWnd, (DWORD)anim);        SendMessage (GetDlgItem (hWnd, 100), ANM_STARTPLAY, 0, 0);        CreateWindow (CTRL_ANIMATION,                           "",                           WS_VISIBLE | ANS_AUTOLOOP,                           200,                           10, 210, 300, 200, hWnd, (DWORD)anim);        break;    }    case MSG_LBUTTONDOWN:        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;#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 = "动画控件" ;    CreateInfo.hMenu = 0;    CreateInfo.hCursor = GetSystemCursor (IDC_ARROW);    CreateInfo.hIcon = 0;    CreateInfo.MainWindowProc = AnimationWinProc;    CreateInfo.lx = 0;     CreateInfo.ty = 0;    CreateInfo.rx = 240;    CreateInfo.by = 320;    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 + -