?
Solved

Drag 'n' Drop in Delphi Console Applications

Posted on 2003-03-08
10
Medium Priority
?
411 Views
Last Modified: 2010-04-04
How i Drag and drop in console applications?? i've only been able to do that in Win32 Apps

-Cyclovenom
0
Comment
Question by:Cyclovenom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 8099781
It's not possible.
0
 

Author Comment

by:Cyclovenom
ID: 8132983
C'mon everything's possible, even if i have to use Win32 API.
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 8133130
You can't because a console app can't be a drop target.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Cyclovenom
ID: 8146638
No, it is possible, i've seen console Apps that has this ability.

http://www.shanky.com/cgi-bin/ryan/download.cgi?lvztoolkit.zip

Drop any file to the makelevel.exe console app and see that it is possible!.

0
 

Author Comment

by:Cyclovenom
ID: 8146646
By the way i meant any file by the extensions .ini or .lvz
0
 

Expert Comment

by:CleanupPing
ID: 9316883
Cyclovenom:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 9326022
If this is still relevant, I have a comment to add.

Cyclovenom: The application you posted is is NOT accepting a dragged file.  It's behaving the same way as any normal application.  Let me get this right:

You are opening Explorer.  Navigating to where the application is located (example, C:\Temp).  From another Explorer window (or the same), you are dragging a file and dropping it onto the filename (buildlevel.exe).

What you are doing is exactly the same as typing BUILDLEVEL.EXE filename at the DOS prompt.  The drag & drop functionality is handled by Windows - not the application.

To replicate this behaviour, all you need to do is use the ParamCount and ParamStr functions.

Eg:

procedure TForm1.FormCreate(Sender: TOBject);
var
  Filename: String;
begin
  if ParamCount = 0 then
   Halt; //No parameters passed

  Filename := ParamStr(1); //ParamStr(0) is the fully qualified filename for the launched executable.
  if not FileExist(Filename) then
    Halt; //File not found
 
  StartProgram(Filename); // Do whatever with the file
end;

Follow what I mean?

So, to get back to our original debate, console apps do not accept drag& drop - Windows Explorer just passes the dropped filename onto the EXE, and the EXE is launched with command line parameters.

Stu

0
 
LVL 6

Accepted Solution

by:
Stuart_Johnson earned 1100 total points
ID: 9326045
And here's how they do it with the other application (DeBuildLevel.EXE)

program ConsoleTest;
{$APPTYPE CONSOLE}
uses SysUtils;


var
  Filename: String;
begin
  Write('Enter filename:');
  ReadLn(Filename);
  WriteLn('The filename entered was:'+Filename);
  WriteLn;
  WriteLn('Press a key to exit');
  ReadLn;
end.

Run it, then drag a file over from Windows Explorer.

Stu
0
 
LVL 5

Expert Comment

by:snehanshu
ID: 10090455
Hi!
No comment has been added lately and this question is therefore classified abandoned.

If asker wishes to close the question, then refer to
http://www.experts-exchange.com/help/closing.jsp

Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:

Answered by: Stuart Johnson

Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

...Snehanshu
EE Cleanup Volunteer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month12 days, 17 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question