Re: Simulate drag and drop from code
- From: "Karl E. Peterson" <karl@xxxxxxxx>
- Date: Fri, 11 Apr 2008 07:07:20 -0700
kpg wrote:
I have a 3rd party program that accepts a text file as input.
The 3rd party software provider said to launch the program
with the file name as an argument (at least that's what I
understood).
I shell to the program from my vb6 app with the name of the
text file I created as an argument and their program generates
an error (error 5, invlaid procedure call or argument).
When I try this from the command prompt I get the same error.
The provider then said to try this: drag the file onto the
program icon - this works.
That's bizarre. Wild guess? Maybe the shortcut link has a startup state it's
using, which is different from whatever the application may have persisted, and it's
blowing in a Resize event?
For whatever reason they can't change the program, so how
can I programatically perform a dran-and-drop type operation
of my text file onto their program?
I believe DND is an OLE operaton. Up to now I've always assumed
that was the same as launching the program from the command line
with the file as an argument - but I guess not.
If there isn't another instance of the application running, I think it's even
simpler than that. I think, in that case, all Windows does is exactly what you
suggest:
To shell to the program I'm the using the API call CreateProcessA
with a command line of the form: 'program.exe file.txt'
It passes the dropped file on the command line. Of course, it'd be properly quoted.
Are you definitely using a filename with no spaces in the name? Have you tried
quoting it to see if they have any horsey logic that expects that?
Another possibility, though slim, is that if another instance is running already
Windows *may* be trying to use DDE to send the name of the new file to it. I show
how to support that, though not necessarily initiate it, here:
http://vb.mvps.org/samples/PrevInst. But, unless TXT files are associated with this
application, I'm pretty sure that isn't what's going on.
--
..NET: It's About Trust!
http://vfred.mvps.org
.
- References:
- Simulate drag and drop from code
- From: kpg
- Simulate drag and drop from code
- Prev by Date: Re: Simulate drag and drop from code
- Next by Date: Re: MDI Forms - What am I missing?
- Previous by thread: Re: Simulate drag and drop from code
- Next by thread: Re: Simulate drag and drop from code
- Index(es):
Relevant Pages
|