Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1061589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:29:44+00:00 2026-05-16T18:29:44+00:00

I have associated a file extension with my Delphi 2009 program. I have been

  • 0

I have associated a file extension with my Delphi 2009 program. I have been using the command line call method to pass the filename to my Delphi program so it can be opened.

However, I found that when selecting multiple files, and clicking on them all at once, it opens each file in a separate instance of my program. I asked about this, and apparently the solution is to use one of the other two Windows methods: DDE or IDropTarget.

But DDE is being deprecated, and MSDN recommends the IDropTarget method. Also Lars Truijens in his answer to me, says that IDropTarget might fit better if I’m already running drag and drop capabilities, which I am.

Currently, this is my drop handler:

private
  procedure WMDropFiles(var WinMsg: TMessage);
            message wm_DropFiles;

procedure TLogoAppForm.FormShow(Sender: TObject);
begin
  DragAcceptFiles(Handle, true);
end;

procedure TLogoAppForm.WMDropFiles(var WinMsg: TMessage);
// From Delphi 3 - User Interface Design, pg 170
const
  BufSize = 255;
var
  TempStr : array[0..BufSize] of Char;
  NumDroppedFiles, I: integer;
  Filenames: TStringList;
begin
  NumDroppedFiles := DragQueryFile(TWMDropFiles(WinMsg).Drop, $ffffffff, nil, 0);
  if NumDroppedFiles >= 1 then begin
    Filenames := TStringList.Create;
    for I := 0 to NumDroppedFiles - 1 do begin
      DragQueryFile(TWMDropFiles(WinMsg).Drop, I, TempStr, BufSize);
      Filenames.Add(TempStr);
    end;
    OpenFiles(Filenames, '');
    Filenames.Free;
  end;
  DragFinish(TWMDropFiles(WinMsg).Drop);
  WinMsg.Result := 0;
end;

It now accepts one or multiple files and will open them as I require. It is very old code, from a Delphi 3 book, but it still seems to work.

What I can’t find is any documentation anywhere on how to implement IDropHandler in Delphi, and specifically to get it working with the Drop Handler (above) that I am using.

Can someone tell me how to use IDropHandler so that clicking on selected files with my file extension will pass them to my Drop Handler and my program can open all the files clicked on?

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:29:44+00:00Added an answer on May 16, 2026 at 6:29 pm

    This page has an example of implementing IDropTarget in Delphi. Here is another from Jedi Code Formatter. But this library might be even better. It, amongst other things, enables dragging and dropping from Windows Explorer and therefore already supports IDropTarget in the TDropHandler class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program that passes command-line arguments to an associated file (i.e. associated
I have a program with an associated file type. However, when I double-click a
I have been provided with a C++ DLL and associated header file in order
I have set up a file extension in the Registry for my program as
My program accepts input file names either as command line parameters or in a
What to look for when I have associated a CSS file with my Default.aspx
I have a Master Page which has an associated css file. On one of
I have a text file of associated numbers i.e; 1 2 2 3 2
I have used Qt Creator and created my.exe file and a new extension .newext
I have a before_save method that I call that renames an uploaded image. before_save

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.