type
TWinArray = array of THandle;
function TdecFSRoot.ExecuteProperties(AMainWin: Cardinal; ARemoteName: PAnsiChar): Integer;
var
NotTC: boolean;
Thr: THandle;
WinArray: TWinArray;
function DoDisableWindow(Window: HWnd; Data: Longint): Bool; stdcall;
begin
if IsWindowVisible(Window) and IsWindowEnabled(Window) then
begin
SetLength(WinArray, Length(WinArray) + 1);
WinArray[Length(WinArray) - 1] := Window;
EnableWindow(Window, False);
end;
Result := True;
end;
procedure EnableTaskWindows;
var i: integer;
begin
for i := 0 to Length(WinArray) - 1 do
if IsWindow(WinArray[i]) then EnableWindow(WinArray[i], True);
SetLength(WinArray, 0);
end;
procedure DisableTaskWindows(AThread: THandle);
begin
try
EnumThreadWindows(AThread, @DoDisableWindow, 0);
except
EnableTaskWindows;
raise;
end;
end;
begin
if not HaveProperties then
begin
Result := FS_EXEC_YOURSELF;
exit;
end;
try
if decGetClassName(AMainWin) <> 'TTOTAL_CMD' then
begin
NotTC := true;
Thr := GetWindowThreadProcessId(AMainWin);
SetLength(WinArray, 0);
DisableTaskWindows(Thr);
end
else
NotTC := false;
try
ShowProperties(AMainWin);
Result := FS_EXEC_OK;
finally
if NotTC then
EnableTaskWindows;
end;
except
Result := FS_EXEC_ERROR;
end;
end;
procedure TdecFSClipboardRoot.ShowProperties(AMainWin: Cardinal);
var AboutForm: TAboutForm2;
begin
Application.Handle := AMainWin;
AboutForm := TAboutForm2.Create(Application);
try
AboutForm.ShowModal(IniFile);
finally
AboutForm.Free;
Application.Handle := 0;
end;
end;
|