问一个关于文件拖放的问题
在做一个压缩的软件.想实现一种效果:把列表框显示的压缩包内文件拖放到资源管理器后会自动解压到对应的地方.
请问当把文件拖放到指定文件夹后如何通知程序由它来进行解压操作?
谢谢!
问题点数:100、回复次数:7Top
1 楼an_bachelor(洗澡就是浪費生命)回复于 2005-08-04 05:29:38 得分 50
在你的程序中响应WM_DROPFILES Message
--------------------------------------------------------------------------------
Sent when the user drops a file on the window of an application that has registered itself as a recipient of dropped files.
Syntax
To send this message, call the SendMessage function as follows.
lResult = SendMessage( // returns LRESULT in lResult (HWND) hWndControl, // handle to destination control (UINT) WM_DROPFILES, // message ID (WPARAM) wParam, // = (WPARAM) (HDROP) hDrop; (LPARAM) lParam // = 0; not used, must be zero );
Parameters
hDrop
Handle to an internal structure describing the dropped files. Pass this handle DragFinish, DragQueryFile, or DragQueryPoint to retrieve information about the dropped files.
lParam
Must be zero.
Return Value
An application should return zero if it processes this message.
Remarks
The HDROP handle is declared in Shellapi.h. You must include this header in your build to use WM_DROPFILES. For further discussion of how to use drag-and-drop to transfer Shell data, see Transferring Shell Data Using Drag-and-Drop or the Clipboard.
Message Information
Header winuser.h
Minimum operating systems Windows NT 3.1, Windows 95
See Also
DragAcceptFiles
--------------------------------------------------------------------------------
© 2005 Microsoft Corporation. All rights reserved.Top
2 楼jiangsheng(蒋晟.Net[MVP])回复于 2005-08-04 07:07:01 得分 50
Transferring Shell Objects with Drag-and-Drop and the Clipboard
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_programming/transferring/transfer.aspTop
3 楼vcleaner(我没当大哥很久了.......)回复于 2005-08-04 08:44:14 得分 0
需要你的软件支持拖放,程序中需要处理一些关于拖放的消息。Top
4 楼firesnowd(火雪)回复于 2005-08-04 23:26:03 得分 0
WM_DROPFILES怎样用的,有没有例子.谢谢!Top
5 楼realmiss(边缘)回复于 2005-08-05 00:21:34 得分 0
查msdn吧Top
6 楼firesnowd(火雪)回复于 2005-08-05 00:31:35 得分 0
WM_DROPFILES不是有文件拖放到本程序窗口上才触发的吗?
但我是要把本程序窗口上的文件拖放到浏览器那里去,当鼠标放下时由本程序进行处理.Top
7 楼firesnowd(火雪)回复于 2005-08-05 17:28:06 得分 0
msdn上说可以用IASyncOperation ,但又找不到具体的用法Top




