3

I had encountered a very strange problem in TForm1.FormDropFiles.

I had attached the entire project. I am unable to locate the problem.

After executing the project form1 is shown and a system tray icon is displayed, when a file is dragged and dropped on form1, then the file name is shown. this works. but when the frmDrop form is invoked from system tray - Show Dropping Platform Menu, and a file is dragged and dropped on frmDrop then the garbage is displayed.

Please have a look in the project and guide, what i had missed in it. The project is attached below.

Demoproject

Rahul
  • 441
  • 1
  • 6
  • 16

1 Answers1

8

The top of your formdrop unit looks like this:

unit formdrop;

{$mode objfpc}

But it should look like this:

unit formdrop;

{$mode objfpc}{$H+}

In objfpc strings are short strings by default. To use long strings you need to add {$H+}. The LCL is compiled for long strings and so you need to match that. If you don't then there is a mismatch between the strings that you receive in your OnDropFiles event and the strings that the LCL sent you.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490