473,383 Members | 1,918 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,383 software developers and data experts.

drag and drop onto exe

hi...

i have a program that opens a couple files and performs some operations
on them.
i wanted to modify my program so that if you drag and drop a file onto
the exe via windows, it will open this file and use it instead.

however, without even modifying my code first, if i drag and drop a
file onto the exe it no longer opens/writes to the files specified by
the program. but when no file is dragged onto it, it runs fine as
normal.

now i assumed that when you drag a file onto the exe it just passes in
an extra parameter.. i dont understand why this should modify the way
the program is run.

any explanation?

Jan 20 '06 #1
9 3517
Mark wrote:
i have a program that opens a couple files and performs some operations
on them.
i wanted to modify my program so that if you drag and drop a file onto
the exe via windows, it will open this file and use it instead.

however, without even modifying my code first, if i drag and drop a
file onto the exe it no longer opens/writes to the files specified by
the program. but when no file is dragged onto it, it runs fine as
normal.

now i assumed that when you drag a file onto the exe it just passes in
an extra parameter.. i dont understand why this should modify the way
the program is run.

any explanation?


Your question is off-topic here. This is a newsgroup for discussion of
the C++ language. That does not encompass the particularities of
individual OSes and APIs. If you have questions about your OS or an
API you are using, please consult a forum related thereto.

Luke

Jan 20 '06 #2
Mark wrote:
hi...

i have a program that opens a couple files and performs some operations
on them.
Nice!
i wanted to modify my program so that if you drag and drop a file onto
the exe via windows, it will open this file and use it instead.
Very good!

however, without even modifying my code first, if i drag and drop a
file onto the exe it no longer opens/writes to the files specified by
the program. but when no file is dragged onto it, it runs fine as
normal.
Uh oh!

now i assumed that when you drag a file onto the exe it just passes in
an extra parameter.. i dont understand why this should modify the way
the program is run.
BLAH

any explanation?


magic.

1. What is your platform? Windows 3.1/95/NT/97/98/2k/xp? OS/2? Windows
emulator on SGI/Linux/FreeBSD/UNIX/.............?

2. How did you make your program? Dev C++/MsVC/CW/Borland/..........?

Just post on a newsgroup that deals with your platform and your
compiler.

Jan 20 '06 #3
dev-c++
windows xp

the following code WILL open the file dragged and dropped onto the exe

if( argc < 2 )
{
cout << "usage: scenario.chk\n";
return EXIT_FAILURE;
}

ifstream chk_in.open(argv[1], ios::binary);

however the other files specified globally don't want to open.

i'm guessing that when i run my program as normal, the constructors for
my files get run first.. but when i run it by drag and drop..perhaps it
skips them?

Jan 20 '06 #4
Mark wrote:
dev-c++
windows xp

What are you relying to?

Shark already pointed you at a windows specific group, you will have
more luck there.

--
Ian Collins.
Jan 20 '06 #5
Mark wrote:
dev-c++
windows xp

the following code WILL open the file dragged and dropped onto the exe

if( argc < 2 )
{
cout << "usage: scenario.chk\n";
return EXIT_FAILURE;
}

ifstream chk_in.open(argv[1], ios::binary);

however the other files specified globally don't want to open.

i'm guessing that when i run my program as normal, the constructors for
my files get run first.. but when i run it by drag and drop..perhaps it
skips them?


Firstly: constructors are not moody }:)

Secondly: if your code works normally, i.e. works from command line but
not with drag and drop you should ask in the newsgroup that deals with
windows programming. Or even on IRC #winprog

Jan 20 '06 #6
alright alright, i'll ask elsewhere.
but i thought it was c++ related.
but just so you know, as long as i declare "ifstream" locally it works.

Jan 20 '06 #7
Mark wrote:
alright alright, i'll ask elsewhere.
Marvelous. Please feel welcome to return when you have an on-topic
question.
but i thought it was c++ related.


You should always read the FAQ for a newsgroup before posting it, to
avoid embarassing yourself and annoying others.

Luke

Jan 20 '06 #8
Mark wrote:
alright alright, i'll ask elsewhere.
but i thought it was c++ related.
but just so you know, as long as i declare "ifstream" locally it works.


If you have a question about your code, don't you think you should post
it completely? I mean with things that work, and don't work, things
that work in certain situations.

If you don't show all pieces of the puzzle it will be hard to guess
what the problem is in the first place. Just a thought.

Jan 21 '06 #9
err.. i know, but there was a lot of code, i thought it might be easier
to explain it.
anyways.. i'm not sure what was causing the problem, but i came up with
a solution.
probably better code too.. guess i shouldnt have been using globals in
the first place.

Jan 22 '06 #10

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

Similar topics

6
by: Colin Young | last post by:
I've got a owner-drawn listview control that displays images and now I'm trying to implement drag and drop so I can drag images from the control and drop them onto other applications. So far if I...
3
by: Patrick Kramer | last post by:
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: ...
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...
1
by: Greg | last post by:
I have a custom control called PageBanner which is compiled into a DLL and then put into the toolbox. It shows like I would expect it to in the toolbox, and I can drag and drop it onto a form. ...
5
by: Brian Henry | last post by:
I haven't worked much with drag/drop but I am trying to make a form that accepts files to drug onto it from explorer and droped and have the form know the full path and file name of the files...
0
by: ViRi | last post by:
I am currently experimenting a bit with AxMicrosoft.MediaPlayer.Intero­p.AxWindowsMediaPlayer and so far, most has gone well. Currently, i would like to add drag-and-drop functionality to the...
0
by: joey.powell | last post by:
I have a Windows Forms application where I need to be able to drag and then drop onto a datagridview control. I already have the code necessary to make the drag part work. I am having problems,...
3
by: Sizer | last post by:
I have several python utils that look at sys.argv to get a list of filenames to process and mangle the files in various ways. If I have a bar.bat file in Windows XP then I can just drag foo.avi...
0
by: munishbatra2002 | last post by:
hi all, we are using a gridview and a treeview control ... we want to drag a row from gridview control and drop it onto treeview control on a web page... we are using C# ASP.NET ... can anyone...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.