Jump to content

Mark-

Members
  • Content Count

    208
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Mark-


  1. 1 minute ago, Brandon Staggs said:

    ...but you may get faster results asking a chat AI to convert it for you.

    I did that a few days ago out of curiosity. I did it a function at a time so it needs work to make it workable.

    procedure FindDesktopFolderView(riid: TGUID; var ppv: Pointer);
    var
      spShellWindows: IShellWindows;
      vtLoc: OleVariant;
      vtEmpty: OleVariant;
      lhwnd: LongInt;
      spdisp: IDispatch;
      spBrowser: IShellBrowser;
      spView: IShellView;
    begin
      spShellWindows := CoShellWindows.Create;
      vtLoc := CSIDL_DESKTOP;
      vtEmpty := VarEmpty;
      spShellWindows.FindWindowSW(vtLoc, vtEmpty, SWC_DESKTOP, lhwnd, SWFO_NEEDDISPATCH, spdisp);
      spBrowser := (spdisp as IServiceProvider).QueryService(SID_STopLevelBrowser, IShellBrowser) as IShellBrowser;
      spBrowser.QueryActiveShellView(spView);
      spView.QueryInterface(riid, ppv);
    end;
    
    -----------------
    
    program DesktopFolderView;
    
    {$APPTYPE CONSOLE}
    {$R *.res}
    
    uses
      System.SysUtils,
      ActiveX,
      ComObj,
      ShlObj,
      ShellAPI;
    
    // CCoInitialize incorporated by reference
    
    function wmain(argc: Integer; argv: PWideChar): Integer;
    var
      init: IUnknown; // Equivalent to CCoInitialize
      spView: IFolderView;
      spFolder: IShellFolder;
      spEnum: IEnumIDList;
      spidl: PItemIDList;
      str: TStrRet;
      spszName: PWideChar;
      pt: TPoint;
    begin
      init := CreateComObject(CLSID_CoInitialize);
      FindDesktopFolderView(IID_IFolderView, spView);
      spView.GetFolder(IID_IShellFolder, spFolder);
    
      spView.Items(SVGIO_ALLVIEW, IID_IEnumIDList, spEnum);
      while spEnum.Next(1, spidl, nil) = S_OK do
      begin
        spFolder.GetDisplayNameOf(spidl, SHGDN_NORMAL, str);
        StrRetToStr(@str, spidl, spszName);
    
        spView.GetItemPosition(spidl, pt);
        Writeln(Format('At %4d,%4d is %s', [pt.x, pt.y, WideString(spszName)]));
        CoTaskMemFree(spidl);
      end;
      Result := 0;
    end;
    
    begin
      try
        CoInitialize(nil);
        wmain(ParamCount, PWideChar(ParamStr(0)));
        CoUninitialize;
      except
        on E: Exception do
          Writeln(E.ClassName, ': ', E.Message);
      end;
    end.
    ---------------------------
    program DesktopFolderRandomPosition;
    
    {$APPTYPE CONSOLE}
    
    uses
      System.SysUtils,
      ActiveX,
      ComObj,
      ShlObj,
      ShellAPI,
      Windows;
    
    function wmain(argc: Integer; argv: PWideChar): Integer;
    var
      init: IUnknown; // Equivalent to CCoInitialize
      spView: IFolderView;
      spEnum: IEnumIDList;
      spidl: PItemIDList;
      pt: TPoint;
      apidl: array[0..0] of PItemIDList;
    begin
      init := CreateComObject(CLSID_CoInitialize);
      FindDesktopFolderView(IID_IFolderView, spView);
    
      spView.Items(SVGIO_ALLVIEW, IID_IEnumIDList, spEnum);
      while spEnum.Next(1, spidl, nil) = S_OK do
      begin
        spView.GetItemPosition(spidl, pt);
        pt.x := pt.x + (Random(5) - 2);
        pt.y := pt.y + (Random(5) - 2);
    
        apidl[0] := spidl;
        spView.SelectAndPositionItems(1, @apidl[0], @pt, SVSI_POSITIONITEM);
        CoTaskMemFree(spidl);
      end;
      Result := 0;
    end;
    
    begin
      try
        CoInitialize(nil);
        Randomize; // Initialize random number generator
        wmain(ParamCount, PWideChar(ParamStr(0)));
        CoUninitialize;
      except
        on E: Exception do
          Writeln(E.ClassName, ': ', E.Message);
      end;
    end.
    ------------------------------------
    procedure SavePositions(pView: IFolderView; pszFile: PWideChar);
    var
      spStream: IStream;
      spEnum: IEnumIDList;
      spidl: PItemIDList;
      pt: TPoint;
    begin
      SHCreateStreamOnFileEx(pszFile, STGM_CREATE or STGM_WRITE,
        FILE_ATTRIBUTE_NORMAL, True, nil, spStream);
      pView.Items(SVGIO_ALLVIEW, IID_IEnumIDList, spEnum);
      while spEnum.Next(1, spidl, nil) = S_OK do
      begin
        WritePidlToStream(spStream, spidl); // Custom function to write PIDL to stream
        pView.GetItemPosition(spidl, pt);
        WritePointToStream(spStream, pt); // Custom function to write POINT to stream
        ILFree(spidl); // Free the PIDL
      end;
    end;
    
    -----------------------------------
    procedure RestorePositions(pView: IFolderView; pszFile: PWideChar);
    var
      spStream: IStream;
      spidl: PItemIDList;
      pt: TPoint;
      apidl: array[0..0] of PItemIDList;
    begin
      // Create a file stream
      SHCreateStreamOnFileEx(pszFile, STGM_READ, FILE_ATTRIBUTE_NORMAL, False, nil, spStream);
      // Read PIDLs and their positions from the stream and restore them
      while Succeeded(IStream_ReadPidl(spStream, spidl)) and
            Succeeded(spStream.Read(@pt, SizeOf(pt), nil)) do
      begin
        apidl[0] := spidl;
        pView.SelectAndPositionItems(1, @apidl[0], @pt, SVSI_POSITIONITEM);
        CoTaskMemFree(spidl); // Free the PIDL
      end;
    end;
    
    // Note: IStream_ReadPidl is a placeholder for the actual function you would use to read a PIDL from a stream.
    // You will need to implement this functionality in Delphi, as it is not provided by Delphi's standard libraries.

     

    • Like 1

  2. 1 hour ago, hsauro said:

    Out of curiosity I checked the original GitHub link, the page has vanished.

    Yeah that was the catalyst for posting here and the webpage of "tinyBigGAMES LLC" did not have it listed. I wonder if he sold his work.


  3. 1 hour ago, Uwe Raabe said:

    Can you try with Light as the initial theme?

    Yes, the buttons show up as normal. Something to do with the theme and IDE foremost application

    I just started with dark and the buttons are not visible. Switch to light, appear, back to dark, still present.

    Switched to another application, back to IDE and buttons disappear.

    At least I now know how to get the buttons to the right location.

     

     


  4. Hello,

     

    Delphi Delphi 10.2 Version 25.0.31059.3231

     

    I have never used the IDE macro feature. Recently the three button controls appeared in the lower left of all code editor windows. The controls may have been in the window, not causing an issue. The controls are blocking the line and column values for the caret position. Any idea how to fix or hide the controls.

     

    image.png.0a69b51e41f49e84fd115d382b67b0a0.png

     

    Thanks,

     

    Mark


  5. Hello,

     

    Delphi-ONVIF-master is around, never used it.

     

    I wrote some code to use ONVIF for PTZ control. Did not use the video portion of the ONVIF specifiation
    For video, most cameras our customers use are MJPEG or RTSP and the video portion of ONVIF did not add any value.

     

    At the time ONVIF PTZ compliance was...marketed but not 100%. Still made it work. 🙂

     

    Good luck,

     

    Mark

    • Like 1

  6. 1 minute ago, Angus Robertson said:

    Why?

     

    Angus

    I use TWSocket the most for industrial communications. Some specifications (e.g. MQTT) are optional SSL and I use TSslWSocket if the end user selects SSL.

    I also use other components for mail/ftp/client and server HTTP with and without SSL.

    Removing "USE_SSL", SSL will continue as an option for all components that already support non-SSL and SSL?

    Any downside from removing "USE_SSL"?


  7. 5 minutes ago, Angus Robertson said:

    Sure there are applications that don't need SSL/TLS so it is optional in most components, the issue is whether those components should be compatible without the SSL./TLS code to save space... 

    For me, space is not an issue. SSL/TLS remaining optional is valuable to me.


  8. 1 hour ago, Angus Robertson said:

    I rarely test without USE_SSL, it will disappear from the next major release since very little of the internet works without SSL/TLS nowadays and all the conditionals and extra classes make maintenance and upgrades a nightmare.

    I assume low level components (TWSocket/etc.) will not be impacted. Most of my ICS use is without SSL.

     

    And thanks for all your work on ICS.

×