论坛风格切换切换到宽版
  • 2764阅读
  • 4回复

如何实现实际安装后去除播放音乐按钮和播放事件,即在未点“完成”时后 [复制链接]

上一主题 下一主题
离线969511048
 

发帖
151
金钱
1440
威望
144
只看楼主 倒序阅读 0 发表于: 2014-01-01
如何实现实际安装后去除播放音乐按钮和播放事件,即在未点击“完成”时

离线969511048

发帖
151
金钱
1440
威望
144
只看该作者 1 发表于: 2014-01-01
我发现个小问题,在实际安装开始时更改卸载图标和更改卸载文件名时,会使大的安装包卡死好一会儿
这个播放音乐的功能放在实际安装时的页面(wpInstalling),也会卡

好像是安装时就开始复制文件了+上这些事件才让它卡的,不知道能不能新建个向导页来实现播放音乐的功能,并且隐藏该向导页。

利用
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssPostInstall then
如何实现关闭音乐
按钮返回为“False”只会使按钮点击无效,音乐删除可按钮健在....初学者不懂
以下代码摘自国外网站并经本人稍微修改......
离线969511048

发帖
151
金钱
1440
威望
144
只看该作者 2 发表于: 2014-01-01
原脚步代码
  1. [CustomMessages]
  2. SoundCtrlButtonCaptionSoundOn=播放音乐
  3. SoundCtrlButtonCaptionSoundOff=关闭音乐
  4. [Code]
  5. const  
  6.   BASS_SAMPLE_LOOP = 4;
  7.   BASS_ACTIVE_STOPPED = 0;
  8.   BASS_ACTIVE_PLAYING = 1;
  9.   BASS_ACTIVE_STALLED = 2;
  10.   BASS_ACTIVE_PAUSED  = 3;
  11.   BASS_UNICODE = $80000000;
  12.   BASS_CONFIG_GVOL_STREAM = 5;
  13. const
  14.   #ifndef UNICODE
  15.     EncodingFlag = 0;
  16.   #else
  17.     EncodingFlag = BASS_UNICODE;
  18.   #endif
  19. type
  20.   HSTREAM = DWORD;
  21. function BASS_Init(device: LongInt; freq, flags: DWORD;
  22.   win: HWND; clsid: Cardinal): BOOL;
  23.   external 'BASS_Init@files:bass.dll stdcall';
  24. function BASS_StreamCreateFile(mem: BOOL; f: string; offset1: DWORD;
  25.   offset2: DWORD; length1: DWORD; length2: DWORD; flags: DWORD): HSTREAM;
  26.   external 'BASS_StreamCreateFile@files:bass.dll stdcall';
  27. function BASS_Start: BOOL;
  28.   external 'BASS_Start@files:bass.dll stdcall';
  29. function BASS_Pause: BOOL;
  30.   external 'BASS_Pause@files:bass.dll stdcall';
  31. function BASS_ChannelPlay(handle: DWORD; restart: BOOL): BOOL;
  32.   external 'BASS_ChannelPlay@files:bass.dll stdcall';
  33. function BASS_SetConfig(option: DWORD; value: DWORD ): BOOL;
  34.   external 'BASS_SetConfig@files:bass.dll stdcall';
  35. function BASS_ChannelIsActive(handle: DWORD): DWORD;
  36.   external 'BASS_ChannelIsActive@files:bass.dll stdcall';
  37. function BASS_Free: BOOL;
  38.   external 'BASS_Free@files:bass.dll stdcall';
  39. var
  40.   SoundStream: HSTREAM;
  41.   SoundCtrlButton: TNewButton;
  42. procedure SoundCtrlButtonClick(Sender: TObject);
  43. begin
  44.   case BASS_ChannelIsActive(SoundStream) of
  45.     BASS_ACTIVE_PLAYING:
  46.     begin
  47.       if BASS_Pause then
  48.         SoundCtrlButton.Caption :=
  49.           ExpandConstant('{cm:SoundCtrlButtonCaptionSoundOn}');
  50.     end;
  51.     BASS_ACTIVE_PAUSED:
  52.     begin
  53.       if BASS_Start then
  54.         SoundCtrlButton.Caption :=
  55.           ExpandConstant('{cm:SoundCtrlButtonCaptionSoundOff}');
  56.     end;
  57.   end;
  58. end;
  59. procedure CurPageChanged ( CurPageID : Integer);
  60. begin
  61.   if CurPageID = wpInstalling then
  62. begin
  63.   ExtractTemporaryFile('AudioFile.mp3');
  64.   if BASS_Init(-1, 44100, 0, 0, 0) then
  65.   begin
  66.     SoundStream := BASS_StreamCreateFile(False,
  67.       ExpandConstant('{tmp}\AudioFile.mp3'), 0, 0, 0, 0,
  68.       EncodingFlag or BASS_SAMPLE_LOOP);
  69.     BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, 2500);
  70.     BASS_ChannelPlay(SoundStream, False);
  71.     SoundCtrlButton := TNewButton.Create(WizardForm);
  72.     SoundCtrlButton.Parent := WizardForm;
  73.     SoundCtrlButton.Left := 168;
  74.     SoundCtrlButton.Top := 184;
  75.     SoundCtrlButton.Width := 155;
  76.     SoundCtrlButton.Caption :=
  77.       ExpandConstant('{cm:SoundCtrlButtonCaptionSoundOff}');
  78.     SoundCtrlButton.OnClick := @SoundCtrlButtonClick;
  79.   end;
  80. end;
  81. end;
  82. procedure DeinitializeSetup;
  83. begin
  84.   BASS_Free;
  85. end;


离线gnatix

发帖
7696
金钱
-8279
威望
-828
只看该作者 3 发表于: 2014-01-01
离线gnatix

发帖
7696
金钱
-8279
威望
-828
只看该作者 4 发表于: 2014-01-01
音乐素材文件不要压缩,最后在启动安装程序时就提取,这样就不会出现卡死的情况了。