Archive: How can I disable (turn off) drag windows (pages)?


How can I disable (turn off) drag windows (pages)?
How can I disable (turn off) drag windows (pages) ?


What do you mean, prevent user from moving the installer window? You could do that by removing the titlebar (whether it's a good idea or not).


aerDNA

You could do that by removing the titlebar
How can this be implemented ?

The simplest and also the best way is to reshack the UI: create a copy of Contrib\UIs\modern.exe, open in ResHacker, in dialog 105 remove WS_MINIMIZEBOX, WS_CAPTION and WS_SYSMENU styles and add WS_DLGFRAME. Then use this UI in your script with !define MUI_UI.

I was playing to see if this can all be done programmatically from within the script, just out of curiosity. You can use the attached script to get a preview of what the installer will look like and see if this is what you really want. Then if you decide to go for it, I suggest you use the reshack method.


Originally posted by aerDNA
I was playing to see if this can all be done programmatically from within the script, just out of curiosity. You can use the attached script to get a preview of what the installer will look like and see if this is what you really want. Then if you decide to go for it, I suggest you use the reshack method.
You shouldn't use the XOR (^) operator to clear flags unless you also test that they are actually set. It will end up adding the flag value when it isn't set, which is not what you want (XOR toggles). Using the ~ and & operators is better. These are semantically equal:

IntOp $R1 ${WS_SYSMENU} ~
IntOp $R0 $R0 & $R1

IntOp $R0 $R0 & ${WS_SYSMENU}
${If} $R0 = ${WS_SYSMENU}
IntOp $R0 $R0 ^ ${WS_SYSMENU}
${EndIf}
Edit: And assuming they are always set is not good practice.

Stu

Snippet #2 is what I would normally use, in this case I didn't think it was necessary. But fair enough, never assume anything.

Edit: ...and you clarified something I didn't fully understand before (XOR toggles).


aerDNA
Thank you for the example. Is it possible to make a travel ban windows "by the rules" ?
For example, like this:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
const
SC_MOVING =61458;
type
TForm1 = class(TForm)
Label1: TLabel;
procedure WndProc(var Msg: TMessage); override;
private
{ Private declarations }

public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.WndProc(var Msg: TMessage);
begin
if (Msg.WParam = SC_MOVING) {or (Msg.WParam = SC_MOVE)} then Exit;
inherited WndProc(msg);
end;

end.

http://stackoverflow.com/questions/1...event-handling


jpderuiter

http://stackoverflow.com/questions/1...event-handling
And as it applies to the question you asked?