Jump to content
limelect

debug message

Recommended Posts

D10.2.3 window 7

I have had this problem for many years I wonder if there is a solution

The program does not break on message in the IDE

However, running the execution it works.

P.S I see the + sign on the form when dragging a file wile in the IDE

      Drag and Drop do not work either

 

I saw David Heffernan solution, but it did not help.

https://stackoverflow.com/questions/14244325/drag-and-drop-files-to-delphi-form-not-working

 

Any help?

 

.

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
    System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, ProCtrls, Vcl.StdCtrls;

type
  TForm1 = class(TForm)
    procedure FormDestroy(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    procedure WMDropFiles(var Msg: TWMDropFiles); message WM_DROPFILES;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses
  ShellAPI;

procedure TForm1.WMDropFiles(var Msg: TWMDropFiles);
begin
  inherited;
  MessageDlg('dssdfsd', mtWarning, [mbOK], 0);<<<<<<<<<<<<  does not break
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  DragAcceptFiles(Self.Handle, False);
  inherited;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
inherited;
  DragAcceptFiles(Self.Handle, True);
end;
end.
 

Edited by limelect

Share this post


Link to post

Delphi forms tend to recreate their window handle at the drop of a hat. So move the DragAcceptFiles calls from the events to overridden CreateWnd and DestroyWnd methods, that makes sure the handle changes are properly handled.

  • Like 1

Share this post


Link to post

@PeterBelow can you plz give me a few lines of code

thanks

p.s do not forget official drag and drop do not work either in the ide

Edited by limelect

Share this post


Link to post
3 hours ago, limelect said:

@PeterBelow can you plz give me a few lines of code

There is code for exactly that in David's answer on the StackOverflow post you linked to.

3 hours ago, limelect said:

p.s do not forget official drag and drop do not work either in the ide

If you are running your app (or the IDE) with elevated rights, then you also need to call ChangeWindowMessageFilter/Ex() to allow lesser-privileged processes, like File Explorer, to send WM_DROPFILES messages to your app.

Edited by Remy Lebeau
  • Like 1

Share this post


Link to post

The Drag and Drop Component Suite contains a demo application that can be used to diagnose a drop target (there's one for drop sources too, fwiw). You could use that to determine the exact interaction between the drop source and target. There is also a demo of WM_DROPFILES, including the handling of ChangeWindowMessageFilter*.

 

The screenshot below shows the Drop Target Analyzer dropping CF_HDROP data (i.e. a file) onto the WM_DROPFILES demo, which is running elevated.

image.thumb.png.850b776de5983a701486b186d3c0dc36.png

 

  • Like 1

Share this post


Link to post

@Remy Lebeau @Anders Melander as i said on my D10.2.3  IDE nothing works as for drop

As for my basic demo, I did exactly the suggestion no !!!! breakpoint in ide

how ever message works with exe

as for the analyzer I cannot drop either in ide or exe

 

I doubt that I can be helped. it has something to do with

my d10.2.3 and my Windows 7 system I guess.

 

One more option is that a component I install does the problem

But since I have large amount it is impossible to find which.

OR an expert?

 

Thanks

Edited by limelect

Share this post


Link to post
8 hours ago, limelect said:

as for the analyzer I cannot drop either in ide or exe

What events does the analyzer show?

 

8 hours ago, limelect said:

One more option is that a component I install does the problem

Hmm. The D&D suite disables the Delphi IDE as a drop target during debugging to avoid the deadlock that would occur if the application being debugged was the drop source and the IDE the drop target.

You can try to uninstall the D&D suite design time package to see if that is the cause.

Share this post


Link to post
1 hour ago, Anders Melander said:

The D&D suite disables the Delphi IDE

Could you plz elaborate I do not recognize this

May be send me link so I know what it si

Share this post


Link to post

I disabled D&d it did not help

I know my problem is someplace in the IDE

Share this post


Link to post

I do not know if this help

The problem of drag and drop (I did not check for messages)

Persist with D7 too.

Drage and Drop does not work on D7 either.

Only outside of Delphi.

So it is Windows 7 ported to ANY Delphi.

Any idea how to check this?

 

\

Share this post


Link to post
1 minute ago, limelect said:

So it is Windows 7 ported to ANY Delphi.

Any idea how to check this?

Are you asking if any version of Delphi supports Windows 7?

Share this post


Link to post

No they all work with this Windows 7. With no problems

All I say is that Drag and Drop does not work under

above conditions in the IDE.

Neither the message problem work on D7

which mean that there is a System problem interacted with  Delphi IDE

Edited by limelect

Share this post


Link to post

I just found that drag-drop within a Delphi project will  in the IDE works

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×