Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
652 views
in Technique[技术] by (71.8m points)

drag and drop - Make Inno Setup WizardForm moveable if titlebar is disabled

I want to make an installer with a custom look and disabled the titlebar by setting the BorderStyle to bsNone.

Now I cannot move the window anymore. I have looked around and found a solution for Delphi:
http://www.chami.com/tips/delphi/010397D.html

Can this be accomplished in Inno Setup?

I have already looked up the WM_NCHITTEST thing on MSDN but I cannot figure out if and how I can make this work.

Edit: After looking around and compiling it using the advanced compiler advanced compiler I came up with this, but it doesn't work. It compiles but when I click inside the window, I cannot drag it.

procedure Dragg(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  SendMessage(WizardForm.Handle, $F112, $F012, 0);
end;

procedure InitializeWizard();
begin
  WizardForm.OnMouseDown := @Dragg;
end;
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

No. There's no way to handle messages or alter the WndProc for controls. There was a little chance to implement the undocumented drag move like in this post, but unfortunately InnoSetup doesn't have mouse down events published for scripting, so you're out of luck without some external libary.


Using the library and code you've mentioned; you are missing the ReleaseCapture function call. Use this script code instead (and don't forget, that the only bare part of the wizard form is on bottom left):

[Code]
function ReleaseCapture: BOOL;
  external 'ReleaseCapture@user32 stdcall';

const
  SC_DRAGMOVE = $F012;
  WM_SYSCOMMAND = $0112;

procedure OnMouseDown(Sender: TObject; Button: TMouseButton; 
  Shift: TShiftState; X, Y: Integer);
begin
  ReleaseCapture;
  WizardForm.Perform(WM_SYSCOMMAND, SC_DRAGMOVE, 0);
end;

procedure InitializeWizard;
begin
  WizardForm.OnMouseDown := @OnMouseDown;
end;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...