DragQueryFile
附件:http://files.cnblogs.com/xe2011/CSharp_DragQueryFile.rar

using System.Runtime.InteropServices;
this.AllowDrop = true;
[DllImport("shell32.dll")]
public static extern uint DragQueryFile(int hDrop, uint iFile, StringBuilder lpszFile, uint cch);
[DllImport("shell32.dll")]
private static extern void DragAcceptFiles(IntPtr hWnd, bool fAccept);
[DllImport("shell32.dll")]
private static extern void DragFinish(int hDrop);
const int WM_DROPFILES = 0x0233;
protected override void WndProc(ref Message Msg)
{
if (Msg.Msg == WM_DROPFILES)
{
uint FilesCount = DragQueryFile((int)Msg.WParam, 0xFFFFFFFF, null, );
richTextBox1.Clear();
StringBuilder FileName = new StringBuilder();
for (uint i = ; i < FilesCount; i++)
{
DragQueryFile((int)Msg.WParam, i, FileName, );
richTextBox1.AppendText(FileName.ToString() + "\r\n");
}
DragFinish((int)Msg.WParam);
return;
}
base.WndProc(ref Msg);
}
private void Form1_Load(object sender, EventArgs e)
{
DragAcceptFiles(this.Handle, true);
}
DragQueryFile的更多相关文章
- 让自己的软件实现拖拽打开文件(使用WM_DROPFILES消息和DragQueryFile函数)
//声明 protected procedure WMDROPFILES(var Msg : TMessage); message WM_DROPFILES; //实现 procedure TForm ...
- 让自己的软件实现拖拽打开文件(覆盖WM_DROPFILES,使用DragQueryFile,DragFinish API函数)
作者: 帅宏军 //声明 protected procedure WMDROPFILES(var Msg : TMessage); message WM_DROPFILES; --------- ...
- windows消息机制详解(转载)
消息,就是指Windows发出的一个通知,告诉应用程序某个事情发生了.例如,单击鼠标.改变窗口尺寸.按下键盘上的一个键都会使Windows发送一个消息给应用程序.消息本身是作为一个记录传递给应用程序的 ...
- C#封装好的Win32API
Kernel.cs using System; using System.Runtime.InteropServices; using System.Text; using HANDLE = Syst ...
- PeCheck
早上起来看到这个代码 整理一下 // PETableDlg.cpp : 实现文件 // #include "stdafx.h" #include "PECheck.h& ...
- [转]Windows系统中监控文件复制操作的几种方式
1. ICopyHook 作用: 监视文件夹和打印机移动,删除, 重命名, 复制操作. 可以得到源和目标文件名. 可以控制拒绝操作. 缺点: 不能对文件进行控制. 只对Shell文件操作有效, 对原生 ...
- COM学习(三)——数据类型
上回书介绍了GUID.CLSID.IID和接口的概念.本回的重点是介绍 COM 中的数据类型.咋还不介绍组件程序的设计步骤呀?咳......别着急,别着急!孔子曰:"饭要一口一口地吃&quo ...
- ListCtrl接受拖动文件
[引言] 拖放操作在电脑中很常用,例如我们经常复制文件就可以按住ctrl键不放,然后再拖到另外一个窗口中,或者,可以把一个WORD文档直接拖动到WORD窗口即可打开,以前我使用过VB,里面直接有Ole ...
- 仿酷狗音乐播放器开发日志二十七 用ole为窗体增加文件拖动功能(附源码)
转载请说明原出处,谢谢~~ 中秋到了,出去玩了几天.今天把仿酷狗程序做了收尾,已经开发完成了,下一篇博客把完结的情况说一下.在这篇博客里说一下使用OLE为窗体增加文件拖拽的功能.使用播放器,我更喜欢直 ...
随机推荐
- Rewrite Path in Asp.Net MVC Project
// Change the current path so that the Routing handler can correctly interpret // the request, then ...
- VOIP概述
简介 VoIP(Voice over Internet Protocol)就是将模拟声音讯号(Voice)数字化,以数据封包(Data Packet)的型式在 IP 数据网络 (IP Network) ...
- js template
http://garann.github.io/template-chooser/ http://www.gbin1.com/technology/javascript/20120917-javasc ...
- ECshop 在迁移到 PHP7 时遇到的兼容性问题
在 PHP7 上安装 ECShop V2.7.3时,报错! Deprecated: Methods with the same name as their class will not be cons ...
- OneAlert 入门(二)——事件分析
OneAlert 是国内首个 SaaS 模式的云告警平台,集成国内外主流监控/支撑系统,实现一个平台上集中处理所有 IT 事件,提升 IT 可靠性.有了 OneAlert,你可以更快更合理地为事件划分 ...
- [mock]10月4日
第一次mock,CollabEdit开一个页面,开始做题.题目是,有方法pow(m,n),m和n都大于1,给出N,有顺序的打印出前N个pow(m,n)的结果.前一个是:4,8,9,16,... 然后在 ...
- HTML标签与表格
1.打开DREAMWEAVER,新建HTML,如下图: 2.body的属性: bgcolor 页面背景色 background 背景壁纸.图片 text 文字颜色 topmargin 上边 ...
- [LeetCode] 303. Range Sum Query - Immutable (Easy)
303. Range Sum Query - Immutable class NumArray { private: vector<int> v; public: NumArray(vec ...
- 开始hadoop
hadoop介绍 分布式存储系统HDFS(Hadoop Distributed File System),提供了高可靠性.高扩展性和高吞吐率的数据存储服务: 资源管理系统YARN(Yet Anothe ...
- 5.android系统裁剪
我手上的android的SDK,是全志A10方案的android4.0.4.由于公司基于这个平台开发一款设备,需要把android自带的软件以及厂家自带的软件去除掉.就研究如何去裁剪android的a ...