| |

VerySource

 Forgot password?
 Register
Search
View: 816|Reply: 4

Regarding how to read the path directly, everyone helps

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-3 11:20:01
| Show all posts |Read mode
The goal is to drag a txt to the exe, and the exe automatically enters the path of the txt.

Thank you.
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-4 21:48:01
| Show all posts
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm1 = class (TForm)
    procedure FormCreate (Sender: TObject);
  private
    procedure WMDRopFile (var Message: TWMDropFiles); Message WM_DROPFILES;
  public
    {Public declarations}
  end;

var
  Form1: TForm1;

implementation
uses
  ShellApi;
{$ R * .dfm}

{TForm1}

procedure TForm1.WMDRopFile (var Message: TWMDropFiles);
var
  NumFiles: integer;
  buffer: array [0..255] of char;
  i: integer;
begin
  NumFiles: = DragQueryFile (Message.Drop, $ FFFFFFFF, nil, 0);
  for i: = 0 to NumFiles-1 do
  begin
    DragQueryFile (Message.Drop, i, buffer, sizeof (buffer));
    // Buff is the file name
    Self.Canvas.TextOut (0, i * 20, Buffer);
  end;

end;



procedure TForm1.FormCreate (Sender: TObject);
begin
  DragAcceptFiles (Handle, true);
end;

end.
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-1-18 23:54:01
| Show all posts
Can you elaborate
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-19 13:36:01
| Show all posts
Not just using the API, the code given is already clear, how can I explain it? Test run
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-7-16 02:15:01
| Show all posts
Can you explain how to use it?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list