Implementing File Drag and Drop in Free Pascal for Windows 10

Implement an AppDropFiles function

Something like this:
uses
  CastleUriUtils;

var
  Window: TCastleWindow;
  ViewMain: TViewMain;

procedure AppDropFiles(Sender: TCastleContainer; const FileNames: array of string);
var
  I: Integer;
  Url: string;
begin
  for I := 0 to Length(FileNames) - 1 do
  begin
    Url := FilenameToUriSafe(FileNames[I]);
    ViewMain.Load(Url);
  end;
end;

Register for receiving File Drops

  Window.RegisterDropTarget;

Assign the above procedure to receive OnDropFiles

  Window.OnDropFiles := {$ifdef FPC}@{$endif}AppDropFiles;

Unregister for receiving File Drops (please test, I haven't yet)

  Window.UnregisterDropTarget