Drag an EXE onto a TreeView control? 
Author Message
 Drag an EXE onto a TreeView control?

Hi all,

First off, I'm reposting this because some disappointing soul seems
to have deleted my previous message.

Does anyone know how to make a TreeView control pickup the
name of a file dropped onto it? Specifically, I need to get the
actual path and filename of an EXE that's dropped from a Win95
folder or desktop onto the control. Any help appreciated.

 - Dave



Fri, 02 Apr 1999 03:00:00 GMT  
 Drag an EXE onto a TreeView control?


Quote:
>This is a multi-part message in MIME format.
>------=_NextPart_000_01BBB9AF.5825ACA0
>Content-Type: text/plain; charset=ISO-8859-1
>Content-Transfer-Encoding: 7bit
>Hi all,
>First off, I'm reposting this because some disappointing soul seems
>to have deleted my previous message.

That is disappointing...

Quote:
>Does anyone know how to make a TreeView control pickup the
>name of a file dropped onto it? Specifically, I need to get the
>actual path and filename of an EXE that's dropped from a Win95
>folder or desktop onto the control. Any help appreciated.

Put these in a module:

Public Const WM_DROPFILES = &H233

Type POINTAPII
        x As Longg
        y As Longg
End Type

Public Declare Sub DragAcceptFiles Lib "shell32.dll" (ByVal hWnd As
Long, ByVal fAccept As Long)

Public Declare Sub DragFinish Lib "shell32.dll" (ByVal HDROP As Long)

Public Declare Function DragQueryFile Lib "shell32.dll" Alias
"DragQueryFileA" (ByVal HDROP As Long, ByVal UINT As Long, ByVal lpStr
As String, ByVal ch As Long) As Long

Public Declare Function DragQueryPoint Lib "shell32.dll" (ByVal HDROP
As Long, lpPoint As POINTAPI) As Long

Put this in your form_load:

Call DragAcceptFiles(TreeView1.hWnd, True)

Get a subclassing control (MSGHOO32.OCX is free and at
www.activexpert.com) and use it to trap the WM_DROPFILES message that
is sent to your TreeView control when a shell object is dropped on
it...

When you get this message, you use the DragQueryFile function to
retrieve the filenames and the DragQueryPoint function to determine
exactly where they were dropped on the TreeView.  Call DragFinish
before exiting the message event.  You can find more info on the exact
usage of these functions in the MSDN Starter Kit that comes with
VB4...  For a TreeView, you will want to use the HitTest method to
determine which node the object was dropped on...

Later...
David Mark
{*filter*}Link Services, Inc.



Sat, 03 Apr 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. drag-dropping a treeview node onto a datagrid

2. Drag N Drop onto an exe?

3. Drag Drop text fragment onto another control

4. Drag and Drop onto a Control Array?

5. : Drag/Drop onto other controls

6. unable to drag controls onto form

7. Drag and Drop onto Picture box in user control

8. dragging and dropping onto user control

9. unable to drag controls onto the form?

10. drag-and-drop from Data Environment designer onto custom control

11. Drag/drop from Explorer TreeView to my VB TreeView

12. Drag from Treeview to Treeview

 

 
Powered by phpBB® Forum Software