473,401 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Windows Explorer Drag and Drop for CLI Arugments

I'm building a file format converter for someone who at best takes more
than his fair share of IT helpdesk hours :D

So I want to make it as simple as possible. What I want it to do is,
run:

program.exe file.txt

When I drop file.txt onto the executable file. In other words, take
whatever file dropped onto the executable as the second CLI arugment.

I don't know how this works, but I have seen it before with the OggDrop
Encoder, where you drop your audio file onto the executable and it
outputs an .ogg encoded file. I've also seen it in pure CLI
executables.. But from working with the OggDrop Source I dont see
anything that would allow me to do what they are doing. And the other
utilities are closed source, so no luck there.

Any Insights, Help or Misc. Commentary would be greatly appreciated.

Nov 8 '05 #1
3 2562
Patrick Kramer wrote:
I'm building a file format converter for someone who at best takes more
than his fair share of IT helpdesk hours :D

So I want to make it as simple as possible. What I want it to do is,
run:

program.exe file.txt

When I drop file.txt onto the executable file. In other words, take
whatever file dropped onto the executable as the second CLI arugment.

I don't know how this works, but I have seen it before with the OggDrop
Encoder, where you drop your audio file onto the executable and it
outputs an .ogg encoded file. I've also seen it in pure CLI
executables.. But from working with the OggDrop Source I dont see
anything that would allow me to do what they are doing. And the other
utilities are closed source, so no luck there.

Any Insights, Help or Misc. Commentary would be greatly appreciated.


That's an OS issue, not so much a programming issue, and so it's
off-topic here. The C++ question would be related to argc and argv, and
if you need help with that, just ask.

Cheers! --M

Nov 8 '05 #2
Patrick Kramer <pk*****@meton.net> wrote:
I'm building a file format converter for someone who at best takes more
than his fair share of IT helpdesk hours :D

So I want to make it as simple as possible. What I want it to do is,
run:

program.exe file.txt

When I drop file.txt onto the executable file. In other words, take
whatever file dropped onto the executable as the second CLI arugment.

I don't know how this works, but I have seen it before with the OggDrop
Encoder, where you drop your audio file onto the executable and it
outputs an .ogg encoded file. I've also seen it in pure CLI
executables.. But from working with the OggDrop Source I dont see
anything that would allow me to do what they are doing. And the other
utilities are closed source, so no luck there.

Any Insights, Help or Misc. Commentary would be greatly appreciated.


<off-topic>
There is no special facility needed, as long as your program handles
argc/argv properly. If you drag and drop files onto the program, it
will pass each file as a command line parameter. Try dragging files
onto this program:

#include <iostream>
#include <string>

int main(int argc, char* argv[])
{
if (argc < 2) {
std::cout << "no files!\n";
}
else {
// argv[0] is probably program name, so skip it
for (int i = 1; i < argc; ++i) {
std::cout << argv[i] << '\n';
}
}

// to pause the screen
std::cout << "\n\nPress <Enter> to quit.\n";
std::string trash;
std::getline(std::cin, trash);

return 0;
}
</off-topic>

--
Marcus Kwok
Nov 8 '05 #3
That's what I needed..

I wrote an exploratory program that excepted CLI arguments in command
prompt and then ouputed the file as output.txt. It worked within the
command prompt, but didn't do anything when I dragged and dropped to
the executable in windows.

I figured I was doing something wrong (apparently :D).. But I'll just
work off the code you submitted, as It does exactly what I want.

Thanks.

Nov 8 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Karsten Schramm | last post by:
Hi, if I drag an Outlook.MailItem to a Windows-Explorer window a <subject>.msg file will be created. Now I try to drag & drop a mail item to my own WinForm app. Unfortunately it doesn't work....
0
by: Lauren Quantrell | last post by:
I'm trying to drop a file from Windows Explorer (or desktop, etc.) onto a field in Access2K and capture the full file path. I found an posting below that says this is possible but I cannot...
5
by: IdeaMan | last post by:
Windows 2000 Access 97 I am working on an issue tracking DB, where I need to link (not attach due to size)screen prints of various system errors. I have created a public folder on a network...
5
by: Clyde | last post by:
I am trying to implement the user feedback provided by Windows Explorer when draggng a filename from one place to another. I have the drag and drop action worked out but have had no luck in...
4
by: Dave | last post by:
I need to add the ability to drag from a Windows Form and drop into a non dotNet application. For example, having a generated image in my app that I wish to drag out into explorer as a friendly way...
0
by: Robin Tucker | last post by:
I've implemented an IDataObject interface around one of my classes in order to facilitate drag/drop from my application into explorer. What I want to do is allow the user to select a series of...
2
by: BradBrigade | last post by:
I want to drag an object from my application into Windows Explorer and have it create a new file, but the object I want to drop is not a file to begin with. It seems the only thing I can do is...
16
by: John | last post by:
I am looking for VBA code that will work with Access 2003 to enable dragging and dropping a file/folder name from Windows XP Explorer into an Access form's text box. This is a common functionality...
2
by: deccio | last post by:
I have create an activex Control with Visual studio 2005 and framework 2.0 in c# to add drag & drop functionality to upload multi file. When I use it in a windows form it work fine. Infact if I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.