[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Drag&Drop: VB _TO_ other apps

Posted on 1997-05-19
6
Medium Priority
?
196 Views
Last Modified: 2012-05-04
My question is essentially the inverse of QID=857726333 (not that that helps any, I'm sure ...)

I need to be able to have a VB application act as a D&D source, with the target some other application. The trick is that I need to be able to specify what type of data is being passed.

Specifically, I want to be able to begin a drag operation in VB, from ANY control, so that the user can drop on PowerPoint (although, the target shouldn't matter). The information that I want passed along is the same information that File Manager/Explorer would sent PowerPoint if I attempted to drag&drop a file.

Really, I just want to be able to tell Windows "Hey, I'm dragging a fileName/file reference, you can do whatever you want with it when I drop it on you" - just as a File Manager / Explorer drag and drop operation does.

I've already encountered the SHELL.DLL routines to _receive_ a Drag&Drop, I need to know how to initiate this operation and specify that the destination app will receive a file / file reference (of my choosing, of course).

Thanks in Advance ...

Slade
0
Comment
Question by:Slade
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 7

Accepted Solution

by:
tward earned 150 total points
ID: 1426400
You should (I haven't tried it) be able to use the SendMessage API call.

You would want to send the WM_DROPFILES message and the application that you dropped the file on should take it from there.....
0
 

Author Comment

by:Slade
ID: 1426401
That's fine, but I'm concerned about how to 'tell' the target application (being dropped upon) WHICH file(s) are being dropped. I realize I can use SendMessage() to send the WM_DROPFILES message, but what do I need to supply for wParam and lParam?
I either need to know the actual values, or where to find them. (I've got the Win16 SDK)

Thanks in advance,

Slade


0
 

Author Comment

by:Slade
ID: 1426402
By the way ...

All of the documentation refers to a data structure called HDROP to which I need to create a handle hDrop (WORD). I can't find ANYWHERE any reference to how this structure is defined!
If I could find the structure, I'd be finished.
Any ideas?

Thanks,

Slade
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 7

Expert Comment

by:tward
ID: 1426403
I haven't been able to find the defined structure either....
0
 

Author Comment

by:Slade
ID: 1426404
Hmmm,

Any other ideas of where to look? I can't do what I need to do without it  :(

Thanks,

Slade


0
 

Author Comment

by:Slade
ID: 1426405
In case anyone else goes looking for this information, the data structure pointed to by HDROP is undocumented. I ended up finding it in an old MSDN CD I had lying around (Apr. 1994).

It turns out the typedef for the data structure is:

typedef struct {
  WORD wSize;  // size of data structure
  POINT ptMousePos;  // position of mouse pointer on drop
  BOOL fInNonClientArea;  // mouse in non-client area on drop?
  BOOL Unicode;  // pathnames use unicode? (only for Win32 -
                 // Win16 does not have this parameter!)
} DROPFILESTRUCT *LPDROPFILESTRUCT;


The trick is that to add a filename, you have to use GlobalReAlloc() to increase the size of the data structure. The pathname(s) are appended to the end of the structure - right after the Unicode parameter. The pathnames must be preceeded by a 0-value character (chr$(0)) and followed by one:

chr$(0) + pathname + chr$(0)

The last pathname has an additional chr$(0) character to indicate that there are no more pathnames:

... + chr$(0) + pathname + chr$(0) + chr$(0)

When adding pathnames to the structure, you have to make sure that you update the wSize parameter accordingly.

Note: On Win32 systems, path names using Unicode systems require a different amound of memory to store than non-Unicode strings!


I haven't tried the above yet, I just have to figure out how to translate all the C++ code in the MSDN example into VB.

Hope this helps someone else ...

Slade


0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question