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 8222303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:13:56+00:00 2026-06-07T14:13:56+00:00

I have a form that accepts files to be dragged and dropped on, as

  • 0

I have a form that accepts files to be dragged and dropped on, as well as a TWebBrowser control placed on a TPanel control on the same form.

The main thing is that, when I drop a file on the form, its path is added to a TEdit control. However, as the user drags and drops the file on the form, sometimes they might actually drop it on the TWebBrowser, which offers to save or run the file for the user, depending on its file type. This is what I actually don’t want to happen, I’d just want for the TWebBrowser to either ignore the dropped file or to process it as the form would do.

This is the code I’m using to treat the WM_DROPFILES message:

procedure TMainForm.AcceptFiles( var msg : TMessage );
const
  cnMaxFileNameLen = 255;
var
  i,
  nCount     : integer;
  acFileName : array [0..cnMaxFileNameLen] of char;
begin
  // find out how many files we're accepting
  nCount := DragQueryFile( msg.WParam,
                           $FFFFFFFF,
                           acFileName,
                           cnMaxFileNameLen );

  // query Windows one at a time for the file name
  for i := 0 to nCount-1 do
  begin
    DragQueryFile( msg.WParam, i,
                   acFileName, cnMaxFileNameLen );

    // do your thing with the acFileName
    //MessageBox( Handle, acFileName, '', MB_OK );
    Edit1.Text := acFileName;
  end;

  // let Windows know that you're done
  DragFinish( msg.WParam );
end;

Thank you in advance. Any clue would be much appreciated.

  • 1 1 Answer
  • 0 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-06-07T14:13:58+00:00Added an answer on June 7, 2026 at 2:13 pm

    To Intercept the drag and drop operations in a TWebBrowser you must implement the IDropTarget and the IDocHostUIHandler interfaces. then you must use the GetDropTarget method to pass you own IDropTarget implementation.

    For a sample delphi code try this article How to handle drag and drop in a TWebBrowser control

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

Sidebar

Related Questions

I have a form that accepts image file, i want to be able to
So I have a form that accepts some input from a user that may
I have a HTML form that accepts a comma separated list of tags, which
I have made a form that accepts query and executes it through php. I
I have a form input in my application that accepts dates in the format
I have a form that accepts user input and asks them to upload a
I have a PHP page that accepts input from a form post, but instead
I have a form page that has an inputText field that accepts a date.
I have created a form that contains fields used to accept a floating value
I currently have form that checks if a user has unsubmitted changes when they

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.