将文件从MS-Explorer拖放到MFC CView中 [英] drag and drop file from MS-Explorer into MFC CView

查看:66
本文介绍了将文件从MS-Explorer拖放到MFC CView中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

删除从ms-explorer拖放的文件时,我在COW2AGView :: OnDrop(COleDataObject * pDataObject,DROPEFFECT dropEffect,CPoint point)成员函数中收到一条通知.
现在,如何获取此文件的完整路径和文件名?

Steph

Hi All,

When droping a file draged from ms-explorer, I receive a notification in my COW2AGView::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point) member function, that''s fine.

Now, how do I get this file''s fullpath and filename?

Steph

推荐答案

研究了一点msdn之后,我认为您应该尝试这种方式:
1)您使用COleDataObject :: GetFileData函数
COleDataObject :: GetFileData 获取指向FORMATETC结构的指针
2)将IDataObject :: GetData与该指针一起使用,以获取指向STGMEDIUM结构的指针
FORMATETC
IDataObject :: GetData
STGMEDIUM
3)然后从STGMEDIUM结构中获取lpszFileName,它应该包含文件的路径和名称.
希望对您有帮助:)
After researching a little bit msdn i think you should try this way :
1) you use the COleDataObject::GetFileData function
COleDataObject::GetFileData to get the pointer to FORMATETC structure
2)use the IDataObject::GetData with that pointer to get the pointer to STGMEDIUM structure
FORMATETC
IDataObject::GetData
STGMEDIUM
3)and then just get the lpszFileName from the STGMEDIUM structure.It should contain the path and the name of the file.
I hope this will help you :)


这篇关于将文件从MS-Explorer拖放到MFC CView中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆