:15.465KB : :1 :2022-10-15 13:23:44
文件拖拽,获得路径如果开发者对于本文件有需要的可以参考。
文件拖拽,获得路径
将文件拖拽到窗口,获得路径的VC 代码
CString CDropEdit::ExpandShortcut(CString &inFile)
{
CString outFile = "";
// Make sure we have a path
ASSERT(inFile != _T(""));
IShellLink* psl;
HRESULT hres;
LPTSTR lpsz = inFile.GetBuffer(MAX_PATH);
// Create instance for shell link
hres = ::CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
IID_IShellLink, (LPVOID*) &psl);
if (SUCCEEDED(hres))
{
// Get a pointer to the persist file interface
IPersistFile* ppf;
hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*) &ppf);
if (SUCCEEDED(hres))
{
// Make sure it's ANSI
WORD wsz[MAX_PATH];
::MultiByteToWideChar(CP_ACP, 0, lpsz, -1, wsz, MAX_PATH);
// Load shortcut
hres = ppf->Load(wsz, STGM_READ);
if (SUCCEEDED(hres))
.
├── DEDemo
│ └── down.liehuo.net
│ ├── DEDemo.001
│ ├── DEDemo.cpp
│ ├── DEDemo.dsp
│ ├── DEDemo.dsw
│ ├── DEDemo.h
│ ├── DEDemo.rc
│ ├── DEDemoDlg.cpp
│ ├── DEDemoDlg.h
│ ├── DropEdit.cpp
│ ├── DropEdit.h
│ ├── ReadMe.txt
│ ├── StdAfx.cpp
│ ├── StdAfx.h
│ ├── down.liehuo.net.url
│ ├── res
│ │ ├── DEDemo.ico
│ │ └── DEDemo.rc2
│ ├── resource.h
│ ├── 烈火学院-丰富的教程基地.url
│ └── 下载必读.txt
└── 将文件拖拽到窗口,获得路径的VC 代码.rar
3 directories, 20 files
01-15易语言文件拖拽拖进
07-13局域网文件拖拽传输软件