Cyclovenom
asked on
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
-Cyclovenom
It's not possible.
ASKER
C'mon everything's possible, even if i have to use Win32 API.
You can't because a console app can't be a drop target.
ASKER
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!.
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!.
ASKER
By the way i meant any file by the extensions .ini or .lvz
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.
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.
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi!
No comment has been added lately and this question is therefore classified abandoned.
If asker wishes to close the question, then refer to
https://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
No comment has been added lately and this question is therefore classified abandoned.
If asker wishes to close the question, then refer to
https://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