Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 450
  • Last Modified:

Drag 'n' Drop in Delphi Console Applications

How i Drag and drop in console applications?? i've only been able to do that in Win32 Apps

-Cyclovenom
0
Cyclovenom
Asked:
Cyclovenom
1 Solution
 
Stuart_JohnsonCommented:
It's not possible.
0
 
CyclovenomAuthor Commented:
C'mon everything's possible, even if i have to use Win32 API.
0
 
Stuart_JohnsonCommented:
You can't because a console app can't be a drop target.
0
Independent Software Vendors: 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!

 
CyclovenomAuthor Commented:
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
 
CyclovenomAuthor Commented:
By the way i meant any file by the extensions .ini or .lvz
0
 
CleanupPingCommented:
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
 
Stuart_JohnsonCommented:
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
 
Stuart_JohnsonCommented:
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
 
snehanshuCommented:
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

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now