gnatix |
2016-01-27 04:27 |
增加了一个计时器,每隔50毫秒钟检查一次播放位置,如果播放位置超过音乐的播放长度,则又从头开始播放。 我这里试了没有问题,你自己试试吧。
- ; 脚本由 Inno Setup 脚本向导 生成!
; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档!
#ifdef UNICODE #define A "W" #else #define A "A" #endif
#define MyAppName "我的程序" #define MyAppVersion "1.5" #define MyAppPublisher "我的公司" #define MyAppURL "http://www.example.com/"
[Setup] ; 注: AppId的值为单独标识该应用程序。 ; 不要为其他安装程序使用相同的AppId值。 ; (生成新的GUID,点击 工具|在IDE中生成GUID。) AppId={{F06FAB78-8E91-4276-A880-ED1CE6299322} AppName={#MyAppName} AppVersion={#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={pf}\{#MyAppName} DefaultGroupName={#MyAppName} OutputBaseFilename=setup Compression=lzma SolidCompression=yes
[Languages] Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"
[Messages] ClickNext=单击“下一步”继续,或单击“取消”退出安装程序。%n%n%n%n%n%n%n%n本程序由陈相宇制作%n%n请于测试完成后24小时删除,否则后果自负!%n%n欢迎绣花爱好者共同讨论%n%nqq:108709796 BeveledLabel=陈相宇制作,请于24小时内删除!
[Files] Source: "D:\Uninstall\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "D:\Richard.mp3"; Flags: dontcopy Source: "D:\waterctrl.dll"; Flags: dontcopy Source: "D:\InnoCallback.dll"; Flags: dontcopy Source: "D:\WizModernImage-Is.bmp"; Flags: dontcopy
[Run] Filename: "{app}\CRACK\安装.bat"; Parameters: "/x"
; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”
[Code] type TTimerProc = procedure(h:longword; msg:longword; idevent:longword; dwTime:longword); // 回调函数参数格式声明
var bmp: TBitmap; tm: TTimer;
Function mciSendString(lpszCommand: String; lpszReturnString: String; cchReturnLength: Integer; hwndCallback: Integer): Integer; external 'mciSendString{#A}@winmm.dll stdcall';
Function mciSendCommand(sCmd: String): LongInt; var iResult: LongInt; sReturn: String; begin SetLength(sReturn,256); iResult := mciSendString(sCmd, sReturn, Length(sReturn), 0); Result := StrToInt(sReturn); end;
procedure tmOnTimer(Sender: TObject); var iCurPos, iLength: LongInt; begin iCurPos := mciSendCommand('status MP3 position'); // 检查当前播放位置 iLength := mciSendCommand('status MP3 length'); // 检查音乐长度 if iCurPos >= iLength Then mciSendCommand('play MP3 from 0'); // 如果播放位置超过长度则从头开始播放 end;
function WrapTimerProc(callback:TTimerProc; paramcount:integer):longword; external 'wrapcallback@files:innocallback.dll stdcall'; // 使用回调函数的主要入口转换函数.
function SetTimer(hWnd: longword; nIDEvent, uElapse: longword; lpTimerFunc: longword): longword; external 'SetTimer@user32.dll stdcall'; // WinAPI 函数, 时间循环函数, 这个函数需要回调函数, 否则不能实现功能
function enablewater(ParentWnd: HWND; Left, Top: integer; Bmp: HBITMAP; WaterRadius, WaterHeight: integer): BOOL; external 'enablewater@files:waterctrl.dll stdcall'; //ParentWnd 放置特效窗口的父窗口句柄。 //Left 左位置 //Top 上位置 //Bmp 位图句柄。 //WaterRadius 水纹半径,会令到水纹看起来范围更广。 //WaterHeight 水纹高度,会令到水纹看起来更深。 //注意,水纹插件自动根据图片来设定高度和宽度, //另外水纹底图必须是翻转的图片,显示的时候会翻转图片来显示。
function waterblob(x, y: integer; radius, height: integer): BOOL; external 'waterblob@files:waterctrl.dll stdcall'; // 在 x,y 点产生半径为radius, 高度为height 的水纹。
function flattenwater(): BOOL; external 'flattenwater@files:waterctrl.dll stdcall'; // 平伏所有水纹。
function disablewater(): BOOL; external 'disablewater@files:waterctrl.dll stdcall'; //释放水纹插件
function setwaterparent(ParentWnd: HWND): BOOL; external 'setwaterparent@files:waterctrl.dll stdcall'; //v2 新增,设置水纹插件的父句柄
procedure mytimerproc(h:longword; msg:longword; idevent:longword; dwTime:longword); begin waterblob(random(162), random(289), random(5), random(200)); // 随机产生小水纹 end;
procedure InitializeWizard(); var timercallback: longword; BGMusicFile, SplashFile: string; SplashForm: TForm; SplashFileName: String; I: Integer; begin tm:= TTimer.Create(WizardForm); tm.Enabled:= false; tm.Interval:= 50; tm.OnTimer:= @tmOnTimer; ExtractTemporaryFile('Richard.mp3'); mciSendString('open "' + ExpandConstant('{tmp}\Richard.mp3') + '" alias MP3', '', 0, 0); SplashForm := TForm.create(nil); with SplashForm do begin mciSendCommand ('play MP3 from 0'); tm.Enabled:= true; Close; Free; end;
ExtractTemporaryFile('WizModernImage-Is.bmp'); bmp := TBitmap.create; bmp.LoadFromFile(ExpandConstant('{tmp}\WizModernImage-Is.bmp')); enablewater(WizardForm.WelcomePage.Handle, 0, 0, bmp.Handle, 3, 50);
timercallback := WrapTimerProc(@mytimerproc,4); // 转换 Inno Setup 的函数入口 settimer(0, 0, 200, timercallback); // 实现 Timer 的循环重复调用函数效果 end;
procedure CurPageChanged(CurPageID: Integer); begin if CurPageID = wpWelcome then begin setwaterparent(WizardForm.WelcomePage.Handle); // waterblob(70, 198, 10, 1000); end else if CurPageID = wpFinished then begin setwaterparent(WizardForm.FinishedPage.Handle); // waterblob(70, 198, 10, 1000); end else flattenwater(); end;
procedure DeinitializeSetup(); begin disablewater(); bmp.Free; end;
|
|