在 Inno Setup 中播放视频/幻灯片时隐藏鼠标指针/光标
Hide mouse pointer / cursor when playing video / slideshow in Inno Setup
我创建了一个 Inno Setup 脚本,它根据我选择播放的内容在程序安装期间播放幻灯片或视频。
当我在幻灯片/视频播放过程中将鼠标移至播放区域时,光标 (crArrow
) 出现在视频/幻灯片上。
我想在播放幻灯片/视频时阻止鼠标光标显示在视频/幻灯片上。
当使用 crNone
属性 处理表单 window (BackgroundForm
) 时,光标仅对其隐藏,而不对幻灯片/视频隐藏。反正我不能在 slideshow/video 中隐藏光标吗?我该如何申请 crNone
?我的意思是 SlideShow.crNone
或 Video.crNone
.
我附上了两张显示光标出现方式的图片。
我如何使用 Inno Media Player 在 BackgroundForm
上处理视频:
procedure PlayMPEGVideo();
begin
if VBRadio2.Checked then begin
if FileExists(ExpandConstant('{tmp}\Video.mp4')) then
begin
if DSInitializeVideoFile(ExpandConstant('{tmp}\Video.mp4'), BackgroundForm.Handle, Width, Height, @BackgroundVideoPlay) then
begin
BackgroundForm.Width := GetSystemMetrics(0);
BackgroundForm.Height := GetSystemMetrics(1);
BASS_Pause;
SoundCtrlButton.Enabled := False;
DSSetVolume(-0);
DSPlayMediaFile;
WizardForm.BringToFront;
PauseBT.Show;
PlayBT1.hide;
PlayBT.hide;
with WizardForm do begin
WizardForm.NextButton.Caption := 'Install';
end;
end;
end;
end else begin
with WizardForm do begin
if CurPageID = wpInstalling then begin
PauseBT.hide;
CompactCheckBox.Visible := False;
WizardForm.WizardSmallBitmapImage.Show;
WizardForm.Bevel1.Show;
with WizardForm do begin
WizardForm.ProgressGauge.show;
end;
end;
end;
end;
end;
我如何使用 isSlideShow:
在 BackgroundForm
上处理幻灯片
procedure MakeSlideShow();
var
i :integer;
begin
if NoBackgroundCheckBox.Checked = True then begin
with WizardForm do begin
if CurPageID=wpInstalling then begin
PauseBT.hide;
CompactCheckBox.Visible := False;
WizardForm.WizardSmallBitmapImage.Show;
WizardForm.Bevel1.Show;
with WizardForm do begin
WizardForm.ProgressGauge.show;
end;
end;
end;
end else begin
BackgroundForm:= TForm.Create(nil);
BackgroundForm.BorderStyle:= bsNone;
BackgroundForm.Color:=clBlack;
BackgroundForm.SetBounds(0, 0, GetSystemMetrics(0), GetSystemMetrics(1))
BackgroundForm.Visible:=True;
BackgroundForm.enabled:= False;
PicList:=tstringlist.Create;
#ifexist "Slides.jpg"
#sub ExtractFile
ExtractTemporaryFile('{#i}.jpg');
#endsub
#for {i = 1; FileExists(StringChange("Slides\FileName.jpg", "FileName", Str(i))) != 0; i++} ExtractFile
#endif
i:=1;
repeat
piclist.add(ExpandConstant('{tmp}\'+IntToStr(i)+'.jpg'));
i:=i+1;
until FileExists(ExpandConstant('{tmp}\'+IntToStr(i)+'.jpg')) = False;
BackgroundForm.Show;
InitializeSlideShow(BackgroundForm.Handle, 0, 0, GetSystemMetrics(0), GetSystemMetrics(1), true, 1);
ShowImage(ExpandConstant('{tmp}') + '.jpg', 1);
PlayBT1 := PlayBT;
end;
end;
提前致谢。
一般,要隐藏鼠标光标,将控件的 .Cursor
属性 设置为 crNone
。
对于 Inno Media Player:它的 API 没有公开 "video" 控件。您将不得不修改其源代码并重新编译。特别是,您需要在 TDirectShowPlayer.InitializeVideoWindow
.
中调用 FVideoWindow
上的 IVideoWindow::HideCursor
method
const
OATRUE = -1;
procedure TDirectShowPlayer.InitializeVideoWindow(WindowHandle: HWND; var Width,
Height: Integer);
begin
ErrorCheck(FGraphBuilder.QueryInterface(IVideoWindow, FVideoWindow));
ErrorCheck(FVideoWindow.HideCursor(OATRUE));
...
end;
请注意,当父 window(BackgroundForm
)被禁用时,它不起作用。所以你不能设置BackgroundForm.Enabled := False
。
要防止 background/video window 被激活,请通过将焦点返回到向导表单来处理 TForm.OnActive
:
procedure BackgroundFormActivated(Sender: TObject);
begin
WizardForm.BringToFront;
end;
...
begin
...
BackgroundForm:= TForm.Create(nil);
...
BackgroundForm.OnActivate := @BackgroundFormActivated;
end;
这是对我有用的完整代码 - 将光标隐藏在背景视频上 - 当使用重新编译的 MediaPlayer.dll
和你提供的 HideCursor
调用时 - 在 [=44 上测试=] 10.
var
BackgroundForm: TForm;
procedure OnMediaPlayerEvent(EventCode, Param1, Param2: Integer);
begin
{ noop }
end;
procedure BackgroundFormActivated(Sender: TObject);
begin
WizardForm.BringToFront;
end;
procedure PlayMPEGVideo();
var
Width, Height: Integer;
begin
BackgroundForm := TForm.Create(nil);
BackgroundForm.BorderStyle := bsNone;
BackgroundForm.Color := clBlack;
BackgroundForm.Visible := True;
BackgroundForm.Cursor := crNone;
BackgroundForm.OnActivate := @BackgroundFormActivated;
Width := GetSystemMetrics(0);
Height := GetSystemMetrics(1);
BackgroundForm.SetBounds(0, 0, Width, Height)
if DSInitializeVideoFile(
'...\video.avi', BackgroundForm.Handle, Width, Height, @OnMediaPlayerEvent) then
begin
DSPlayMediaFile;
WizardForm.BringToFront;
end;
end;
对于 isSlideShow:我没有找到这方面的任何文档或源代码。
我创建了一个 Inno Setup 脚本,它根据我选择播放的内容在程序安装期间播放幻灯片或视频。
当我在幻灯片/视频播放过程中将鼠标移至播放区域时,光标 (crArrow
) 出现在视频/幻灯片上。
我想在播放幻灯片/视频时阻止鼠标光标显示在视频/幻灯片上。
当使用 crNone
属性 处理表单 window (BackgroundForm
) 时,光标仅对其隐藏,而不对幻灯片/视频隐藏。反正我不能在 slideshow/video 中隐藏光标吗?我该如何申请 crNone
?我的意思是 SlideShow.crNone
或 Video.crNone
.
我附上了两张显示光标出现方式的图片。
我如何使用 Inno Media Player 在 BackgroundForm
上处理视频:
procedure PlayMPEGVideo();
begin
if VBRadio2.Checked then begin
if FileExists(ExpandConstant('{tmp}\Video.mp4')) then
begin
if DSInitializeVideoFile(ExpandConstant('{tmp}\Video.mp4'), BackgroundForm.Handle, Width, Height, @BackgroundVideoPlay) then
begin
BackgroundForm.Width := GetSystemMetrics(0);
BackgroundForm.Height := GetSystemMetrics(1);
BASS_Pause;
SoundCtrlButton.Enabled := False;
DSSetVolume(-0);
DSPlayMediaFile;
WizardForm.BringToFront;
PauseBT.Show;
PlayBT1.hide;
PlayBT.hide;
with WizardForm do begin
WizardForm.NextButton.Caption := 'Install';
end;
end;
end;
end else begin
with WizardForm do begin
if CurPageID = wpInstalling then begin
PauseBT.hide;
CompactCheckBox.Visible := False;
WizardForm.WizardSmallBitmapImage.Show;
WizardForm.Bevel1.Show;
with WizardForm do begin
WizardForm.ProgressGauge.show;
end;
end;
end;
end;
end;
我如何使用 isSlideShow:
在BackgroundForm
上处理幻灯片
procedure MakeSlideShow();
var
i :integer;
begin
if NoBackgroundCheckBox.Checked = True then begin
with WizardForm do begin
if CurPageID=wpInstalling then begin
PauseBT.hide;
CompactCheckBox.Visible := False;
WizardForm.WizardSmallBitmapImage.Show;
WizardForm.Bevel1.Show;
with WizardForm do begin
WizardForm.ProgressGauge.show;
end;
end;
end;
end else begin
BackgroundForm:= TForm.Create(nil);
BackgroundForm.BorderStyle:= bsNone;
BackgroundForm.Color:=clBlack;
BackgroundForm.SetBounds(0, 0, GetSystemMetrics(0), GetSystemMetrics(1))
BackgroundForm.Visible:=True;
BackgroundForm.enabled:= False;
PicList:=tstringlist.Create;
#ifexist "Slides.jpg"
#sub ExtractFile
ExtractTemporaryFile('{#i}.jpg');
#endsub
#for {i = 1; FileExists(StringChange("Slides\FileName.jpg", "FileName", Str(i))) != 0; i++} ExtractFile
#endif
i:=1;
repeat
piclist.add(ExpandConstant('{tmp}\'+IntToStr(i)+'.jpg'));
i:=i+1;
until FileExists(ExpandConstant('{tmp}\'+IntToStr(i)+'.jpg')) = False;
BackgroundForm.Show;
InitializeSlideShow(BackgroundForm.Handle, 0, 0, GetSystemMetrics(0), GetSystemMetrics(1), true, 1);
ShowImage(ExpandConstant('{tmp}') + '.jpg', 1);
PlayBT1 := PlayBT;
end;
end;
提前致谢。
一般,要隐藏鼠标光标,将控件的 .Cursor
属性 设置为 crNone
。
对于 Inno Media Player:它的 API 没有公开 "video" 控件。您将不得不修改其源代码并重新编译。特别是,您需要在 TDirectShowPlayer.InitializeVideoWindow
.
FVideoWindow
上的 IVideoWindow::HideCursor
method
const
OATRUE = -1;
procedure TDirectShowPlayer.InitializeVideoWindow(WindowHandle: HWND; var Width,
Height: Integer);
begin
ErrorCheck(FGraphBuilder.QueryInterface(IVideoWindow, FVideoWindow));
ErrorCheck(FVideoWindow.HideCursor(OATRUE));
...
end;
请注意,当父 window(BackgroundForm
)被禁用时,它不起作用。所以你不能设置BackgroundForm.Enabled := False
。
要防止 background/video window 被激活,请通过将焦点返回到向导表单来处理 TForm.OnActive
:
procedure BackgroundFormActivated(Sender: TObject);
begin
WizardForm.BringToFront;
end;
...
begin
...
BackgroundForm:= TForm.Create(nil);
...
BackgroundForm.OnActivate := @BackgroundFormActivated;
end;
这是对我有用的完整代码 - 将光标隐藏在背景视频上 - 当使用重新编译的 MediaPlayer.dll
和你提供的 HideCursor
调用时 - 在 [=44 上测试=] 10.
var
BackgroundForm: TForm;
procedure OnMediaPlayerEvent(EventCode, Param1, Param2: Integer);
begin
{ noop }
end;
procedure BackgroundFormActivated(Sender: TObject);
begin
WizardForm.BringToFront;
end;
procedure PlayMPEGVideo();
var
Width, Height: Integer;
begin
BackgroundForm := TForm.Create(nil);
BackgroundForm.BorderStyle := bsNone;
BackgroundForm.Color := clBlack;
BackgroundForm.Visible := True;
BackgroundForm.Cursor := crNone;
BackgroundForm.OnActivate := @BackgroundFormActivated;
Width := GetSystemMetrics(0);
Height := GetSystemMetrics(1);
BackgroundForm.SetBounds(0, 0, Width, Height)
if DSInitializeVideoFile(
'...\video.avi', BackgroundForm.Handle, Width, Height, @OnMediaPlayerEvent) then
begin
DSPlayMediaFile;
WizardForm.BringToFront;
end;
end;
对于 isSlideShow:我没有找到这方面的任何文档或源代码。