Jump to content

PeterPanettone

Members
  • Content Count

    456
  • Joined

  • Last visited

  • Days Won

    1

PeterPanettone last won the day on October 20 2019

PeterPanettone had the most liked content!

Community Reputation

67 Excellent

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. PeterPanettone

    r3040 build error

    Thanks, now the errors have disappeared.
  2. In the Delphi Rio 10.3.3 IDE, I have activated the floating form designer by unchecking the "Embedded designer" checkbox in the Options dialog: The floating form designer normally stays on the second monitor. When I reopen a VCL Application project, the previously opened form designer is not automatically restored and I have to manually open it with F12 which often takes a relatively long time. This is one of the small IDE annoyances. Has anyone also experienced this?
  3. PeterPanettone

    r3040 build error

    When trying to build r3040 in Delphi 10.3.3 I got this warnings/errors: [Exec Error] Warning(1): File not found: [...]\gexperts-code-r3040-trunk\Projects\DelphiXx103\GExpertsRS103.manifest.in(EFileNotFound) [Exec Error] Der Befehl "call ..\..\buildtools\prebuild.cmd "C:\COMP\_Addons\GExperts\GExperts Sourcecode\gexperts-code-r3040-trunk\Projects\DelphiXx103\GExpertsRS103.dproj"&&call ..\..\buildtools\movedll.cmd "C:\COMP\_Addons\GExperts\GExperts Sourcecode\gexperts-code-r3040-trunk\Binaries\GExpertsRS103.dll"" wurde mit dem Code 9009 beendet.
  4. Do you also have an unusual WAITING TIME of about 2 - 3 seconds when restoring the IDE window from minimized state?
  5. What is your screen resolution?
  6. This is how my Delphi v10.3.3 IDE window normally looks: But MANY TIMES, when I restore the IDE window from MINIMIZED window state (by clicking on the Delphi icon on the Windows Taskbar) there is a substantial vertical GAP between the MainMenu/Toolbar area and the main panels area: I then double-click twice on the IDE window title-bar to restore the usual IDE layout. For testing, I have disabled all my IDE plugins to exclude any possible influence from such a plugin. Has anybody ever experienced this annoying effect?
  7. PeterPanettone

    Fix for bug in JclShell

    Why do you want to throw away the fish before eating it?
  8. PeterPanettone

    Fix for bug in JclShell

    This is a more SECURE version of SaveShortcutShellLinkAsAdministrator for the demo app: procedure TformMain.SaveShortcutShellLink(const AFile: string); var SL: JclShell.TShellLink; HR: Integer; begin SL.Target := 'C:\Windows\System32\notepad.exe'; SL.HotKey := Winapi.Windows.MakeWord(Byte(HotKey1.HotKey), Byte(HotKey1.Modifiers)); // other ShellLink properties: SL.Description := 'My description'; HR := JclShell.ShellLinkCreate(SL, AFile); if HR <> Winapi.Windows.S_OK then begin if not SaveShortcutShellLinkAsAdministrator(AFile, SL) then MessageDlg('The Shortcut ShellLink could not be saved even with Administrator rights.', mtError, [mbOK], 0); end; end; function TformMain.SaveShortcutShellLinkAsAdministrator(const AFile: string; AShellLink: JclShell.TShellLink): Boolean; // SECURELY create Shortcut ShellLink as administrator var ts, ThisTempLnkFile, ThisParams, SourceHash, TargetHash: string; function GetHashFromFile(const AFileToHash: string): string; var IdMD5: IdHashMessageDigest.TIdHashMessageDigest5; FS: TFileStream; begin IdMD5 := IdHashMessageDigest.TIdHashMessageDigest5.Create; FS := TFileStream.Create(AFileToHash, fmOpenRead or fmShareDenyWrite); try Result := IdMD5.HashStreamAsHex(FS); finally FS.Free; IdMD5.Free; end; end; begin Result := False; // create temporary ShellLink Shortcut: System.SysUtils.DateTimeToString(ts, 'yymmddhhnnsszzz', Now); ThisTempLnkFile := System.SysUtils.IncludeTrailingBackslash(System.IOUtils.TPath.GetTempPath) + ts + '.lnk'; if JclShell.ShellLinkCreate(AShellLink, ThisTempLnkFile) = Winapi.Windows.S_OK then begin // get the MD5 hash of the temporary ShellLink Shortcut (to compare it later with the target hash): SourceHash := GetHashFromFile(ThisTempLnkFile); end else begin MessageDlg('Could not create a temporary ShellLink Shortcut', mtError, [mbOK], 0); EXIT; end; // MOVE the temporary ShellLink Shortcut to the real target: // https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd ThisParams := '/C move ' + '"' + ThisTempLnkFile + '"' + ' ' + '"' + AFile + '"'; Result := JclShell.ShellExecAndWait('cmd.exe', ThisParams, 'runas', SW_HIDE); if not Result then EXIT; //OR: Winapi.ShellAPI.ShellExecute(0, 'runas', 'cmd.exe', PChar(ThisParams), '', Winapi.Windows.SW_HIDE); // Check whether the target file exists: if not FileExists(AFile) then EXIT; // Compare the MD5 hashes of the source file and of the target file: TargetHash := GetHashFromFile(AFile); Result := SameText(SourceHash, TargetHash); end;
  9. PeterPanettone

    Fix for bug in JclShell

    This has nothing to do directly with JclShell, but it adds useful functionality to the demo app: Since ShellLink Shortcuts are often created in protected locations such as in StartMenu directories or on a Desktop (e.g. "C:\Users\Public\Desktop") I have added a routine which automatically saves the ShellLink Shortcut with Administrator rights if the saving with normal user rights fails: procedure TformMain.SaveShortcutShellLink(const AFile: string); var SL: JclShell.TShellLink; HR: Integer; begin SL.Target := 'C:\Windows\System32\notepad.exe'; // Uncomment the following code line to include the modifier keys in the saved ShellLink Shortcut: SL.HotKey := Winapi.Windows.MakeWord(Byte(HotKey1.HotKey), Byte(HotKey1.Modifiers)); // other ShellLink properties: SL.Description := 'My description'; HR := JclShell.ShellLinkCreate(SL, AFile); if HR <> Winapi.Windows.S_OK then SaveShortcutShellLinkAsAdministrator(AFile, SL); end; procedure TformMain.SaveShortcutShellLinkAsAdministrator(const AFile: string; AShellLink: JclShell.TShellLink); var ts, ThisTempLnkFile, ThisParams: string; ThisShellExecExResult: Boolean; begin System.SysUtils.DateTimeToString(ts, 'yymmddhhnnsszzz', Now); ThisTempLnkFile := System.SysUtils.IncludeTrailingBackslash(System.IOUtils.TPath.GetTempPath) + ts + '.lnk'; JclShell.ShellLinkCreate(AShellLink, ThisTempLnkFile); // https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd ThisParams := '/C move ' + '"' + ThisTempLnkFile + '"' + ' ' + '"' + AFile + '"'; ThisShellExecExResult := JclShell.ShellExecEx('cmd.exe', ThisParams, 'runas', SW_HIDE); //Winapi.ShellAPI.ShellExecute(0, 'runas', 'cmd.exe', PChar(ThisParams), '', Winapi.Windows.SW_HIDE); end;
  10. PeterPanettone

    Fix for bug in JclShell

    But even much simpler would be: procedure TformMain.LoadShortcutShellLink(const AFile: string); var SL: JclShell.TShellLink; begin JclShell.ShellLinkResolve(AFile, SL); HotKey1.HotKey := SL.HotKey_; end; Andreas, could you please implement this in JclShell. Thank you! And also the opposite conversion should be done internally in JclShell. In this way, the user would not have to do any conversions himself: procedure TformMain.SaveShortcutShellLink(const AFile: string); var SL: JclShell.TShellLink; HotKeyModifiers: Byte; begin SL.Target := 'C:\Windows\System32\notepad.exe'; SL.HotKey_ := HotKey1.HotKey; JclShell.ShellLinkCreate(SL, AFile); end; For this, the declaration of JclShell.TShellLink.Hotkey needs to be set to TShortcut. This really is a bug in JclShell. To make this compatible to existing code, I would redeclare the TShellLink record in JclShell in this way: // Shortcuts / Shell link type PShellLink = ^TShellLink; TShellLink = record Arguments: string; ShowCmd: Integer; WorkingDirectory: string; IdList: PItemIDList; Target: string; Description: string; IconLocation: string; IconIndex: Integer; HotKey: Word; // Use ShellLinkShortCut() to convert it to a TShortCut or simply use: HotKey_: TShortCut; end;
  11. PeterPanettone

    Fix for bug in JclShell

    This is the new code added by Andreas to JclShell: function ShellLinkShortCut(const Link: TShellLink): TShortCut; type THotKeyModifiers = set of (hkShift, hkCtrl, hkAlt, hkExt); var Modifiers: THotKeyModifiers; begin if Link.HotKey = 0 then Result := scNone else begin Modifiers := THotKeyModifiers(HiByte(Link.HotKey)); Result := LoWord(LoByte(Link.HotKey)); if hkShift in Modifiers then Result := Result or scShift; if hkCtrl in Modifiers then Result := Result or scCtrl; if hkAlt in Modifiers then Result := Result or scAlt; end; end; This reduces the code in my demo app to load the ShellLink Shortcut to: procedure TformMain.LoadShortcutShellLink(const AFile: string); var SL: JclShell.TShellLink; begin JclShell.ShellLinkResolve(AFile, SL); HotKey1.HotKey := JclShell.ShellLinkShortCut(SL); end;
  12. PeterPanettone

    Fix for bug in JclShell

    Congratulations, Andreas is a very fast guy! Thanks, Andreas!
  13. PeterPanettone

    Fix for bug in JclShell

    How would you resolve this "handling error"?
  14. PeterPanettone

    Fix for bug in JclShell

    I have tried to report the bug here: https://issuetracker.delphi-jedi.org/bug_report.php ...but I got this error message: This page isn’t working issuetracker.delphi-jedi.org is currently unable to handle this request. HTTP ERROR 500
×