您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DragQueryFile函数代码示例

51自学网 2021-06-01 20:29:51
  C++
这篇教程C++ DragQueryFile函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DragQueryFile函数的典型用法代码示例。如果您正苦于以下问题:C++ DragQueryFile函数的具体用法?C++ DragQueryFile怎么用?C++ DragQueryFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了DragQueryFile函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: UNREFERENCED_PARAMETER

HRESULT __stdcall CBookmarksToolbarDropHandler::DragEnter(IDataObject *pDataObject,	DWORD grfKeyState,POINTL pt,DWORD *pdwEffect){	UNREFERENCED_PARAMETER(grfKeyState);	bool m_bValid = false;	bool m_bAllFolders = true;	FORMATETC ftc = {CF_HDROP,0,DVASPECT_CONTENT,-1,TYMED_HGLOBAL};	STGMEDIUM stg;	HRESULT hr = pDataObject->GetData(&ftc,&stg);	if(hr == S_OK)	{		DROPFILES *pdf = reinterpret_cast<DROPFILES *>(GlobalLock(stg.hGlobal));		if(pdf != NULL)		{			m_bValid = true;			UINT nDroppedFiles = DragQueryFile(reinterpret_cast<HDROP>(pdf),0xFFFFFFFF,NULL,NULL);			for(UINT i = 0;i < nDroppedFiles;i++)			{				TCHAR szFullFileName[MAX_PATH];				DragQueryFile(reinterpret_cast<HDROP>(pdf),i,szFullFileName,					SIZEOF_ARRAY(szFullFileName));				if(!PathIsDirectory(szFullFileName))				{					m_bAllFolders = false;					break;				}			}			GlobalUnlock(stg.hGlobal);		}		ReleaseStgMedium(&stg);	}	if(m_bValid &&		m_bAllFolders)	{		*pdwEffect = DROPEFFECT_COPY;		m_bAcceptData = true;	}	else	{		*pdwEffect = DROPEFFECT_NONE;		m_bAcceptData = false;	}	m_pDropTargetHelper->DragEnter(m_hToolbar,pDataObject,reinterpret_cast<POINT *>(&pt),*pdwEffect);	return S_OK;}
开发者ID:hollylee,项目名称:explorerplusplus,代码行数:60,


示例2: SetActiveWindow

void CMainFrame::OnDropFiles( HDROP hDropInfo ){	SetActiveWindow();      // activate us first !	CWinApp* pApp = AfxGetApp();	ASSERT(pApp != NULL);	CString strFile;	UINT nFilesCount=DragQueryFile(hDropInfo,INFINITE,NULL,0);	for(UINT i=0; i<nFilesCount; i++)	{		int pathLen = DragQueryFile(hDropInfo, i, strFile.GetBuffer(MAX_PATH), MAX_PATH);		strFile.ReleaseBuffer(pathLen);		DWORD dwFileAttr = ::GetFileAttributes(strFile);		if ((dwFileAttr & FILE_ATTRIBUTE_DIRECTORY)==FILE_ATTRIBUTE_DIRECTORY)		{			//目录,需要递归里面包含的文件		}		else		{			CString strExt=strFile.Mid(strFile.GetLength()-4,4);			if (strExt.CompareNoCase(_T(".xml"))==0)			{				pApp->OpenDocumentFile(strFile);			}		}	}	DragFinish(hDropInfo);}
开发者ID:abael,项目名称:pyui4win,代码行数:29,


示例3: DragAcceptFiles

void CFilesHashDlg::OnDropFiles(HDROP hDropInfo){	if(!m_thrdData.threadWorking)	{		unsigned int i;		TCHAR szDragFilename[MAX_PATH];		DragAcceptFiles(FALSE);		m_thrdData.nFiles = DragQueryFile(hDropInfo, -1, NULL, 0);		ClearFilePaths();		for(i=0; i < m_thrdData.nFiles; i++)		{			DragQueryFile(hDropInfo, i, szDragFilename, sizeof(szDragFilename));			CString tmp;			tmp.Format(_T("%s"), szDragFilename);			m_thrdData.fullPaths.push_back(tmp);		}		DragFinish(hDropInfo);		DragAcceptFiles(TRUE);		DoMD5();	}}
开发者ID:Koogoo,项目名称:fhash,代码行数:25,


示例4: GlobalLock

STDMETHODIMP CShooterContextMenuExt::Initialize (   LPCITEMIDLIST pidlFolder,  LPDATAOBJECT pDataObj,  HKEY hProgID ){	TCHAR     szFile[MAX_PATH];	FORMATETC fmt = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };	STGMEDIUM stg = { TYMED_HGLOBAL };	HDROP     hDrop;	// Look for CF_HDROP data in the data object.	if ( FAILED( pDataObj->GetData ( &fmt, &stg ) ))	{		// Nope! Return an "invalid argument" error back to Explorer.		return E_INVALIDARG;	}	// Get a pointer to the actual data.	hDrop = (HDROP) GlobalLock ( stg.hGlobal );	// Make sure it worked.	if ( NULL == hDrop )	{		ReleaseStgMedium ( &stg );		return E_INVALIDARG;	}	// Sanity check - make sure there is at least one filename.	UINT uNumFiles = DragQueryFile ( hDrop, 0xFFFFFFFF, NULL, 0 );	HRESULT hr = S_OK;	if ( 0 == uNumFiles )	{		GlobalUnlock ( stg.hGlobal );		ReleaseStgMedium ( &stg );		return E_INVALIDARG;	}	// Get the name of the first file and store it in our member variable m_szFile.	m_bHasDir = false;	for(UINT uFile = 0 ; uFile < uNumFiles ; uFile++)	{		if(0 == DragQueryFile(hDrop, uFile, szFile, MAX_PATH))			continue;		ATLTRACE("Checking file <%s>/n", szFile);		m_fileList.push_back(szFile);		if(IsDir(szFile))			m_bHasDir = true;	}	GlobalUnlock ( stg.hGlobal );	ReleaseStgMedium ( &stg );	return hr;}
开发者ID:4770K,项目名称:shooter-downloader,代码行数:60,


示例5: DragQueryFile

LRESULT MetroWindow::OnDropfiles(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled){	WCHAR iPath[MAX_UNC_PATH] = { 0 };	UINT nFileCnt = DragQueryFile((HDROP)wParam, 0xFFFFFFFF, NULL, 0);	if (DragQueryFile((HDROP)wParam, nFileCnt - 1, iPath, MAX_UNC_PATH))	{		std::wstring wstr = iPath;		std::wstring::size_type pos = wstr.rfind(L".iso");		if (pos != wstr.length() - 4)			return 1;		::SetWindowText(GetDlgItem(IDC_EDIT_IMAGE), wstr.c_str());		ProcessInfo = L"Manager Task Rate:";		JobStatusRate = L"Task not start";		MTNotices = L"Notices> Enviroment Inspection:/n" + envinfo;		m_proge.SetPos(0);		HANDLE hFile;		LARGE_INTEGER FileSize;		hFile = CreateFile(wstr.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);		if (hFile != INVALID_HANDLE_VALUE)		{			GetFileSizeEx(hFile, &FileSize);			swprintf_s(SizeStr, L" %lld Bytes ||%4.1f KB ||%4.2f MB ||%4.2f GB/0", FileSize.QuadPart, (float)FileSize.QuadPart / 1024, (float)FileSize.QuadPart / (1024 * 1024), (float)FileSize.QuadPart / (1024 * 1024 * 1024));			SendMessage(WM_PAINT, 0, 0);		}		CloseHandle(hFile);		//::MessageBox(m_hWnd, iPath, L"Drag the image file is:", MB_OK | MB_ICONASTERISK);	}	return 0;}
开发者ID:codepongo,项目名称:iBurnMgr,代码行数:29,


示例6: Add_File_Events

static void Add_File_Events(REBGOB *gob, REBINT flags, HDROP drop){	REBEVT evt;	REBINT num;	REBINT len;	REBINT i;	REBCHR* buf;	POINT xy;	//Get the mouse position	DragQueryPoint(drop, &xy);	evt.type  = EVT_DROP_FILE;	evt.flags = (u8) (flags | (1<<EVF_HAS_XY));	evt.model = EVM_GUI;	evt.data = xy.x | xy.y<<16;	num = DragQueryFile(drop, -1, NULL, 0);	for (i = 0; i < num; i++){		len = DragQueryFile(drop, i, NULL, 0);		buf = OS_Make(len+1);		DragQueryFile(drop, i, buf, len+1);		//Reb_Print("DROP: %s", buf);		buf[len] = 0;		// ?! convert to REBOL format? E.g.: evt.ser = OS_To_REBOL_File(buf, &len);		OS_Free(buf);		if (!RL_Event(&evt)) break;	// queue is full	}}
开发者ID:Oldes,项目名称:R3A110,代码行数:31,


示例7: OnDropFile

void OnDropFile (DWORD wParam)   {   TCHAR FileName [FilePathLen + 1] ;   LPTSTR         pFileNameStart ;   HANDLE         hFindFile ;   WIN32_FIND_DATA FindFileInfo ;   int            NameOffset ;   int            NumOfFiles = 0 ;   NumOfFiles = DragQueryFile ((HDROP) wParam, 0xffffffff, NULL, 0) ;   if (NumOfFiles > 0)      {      // we only open the first file for now      DragQueryFile((HDROP) wParam, 0, FileName, FilePathLen) ;      pFileNameStart = ExtractFileName (FileName) ;      NameOffset = pFileNameStart - FileName ;      // convert short filename to long NTFS filename if necessary      hFindFile = FindFirstFile (FileName, &FindFileInfo) ;      if (hFindFile && hFindFile != INVALID_HANDLE_VALUE)         {         // append the file name back to the path name         lstrcpy (&FileName[NameOffset], FindFileInfo.cFileName) ;         FindClose (hFindFile) ;         }      FileOpen (hWndMain, (int)0, (LPTSTR)FileName) ;      PrepareMenu (GetMenu (hWndMain));      }   DragFinish ((HDROP) wParam) ;   }
开发者ID:mingpen,项目名称:OpenNT,代码行数:33,


示例8: DragQueryFile

//---------------------------------------------------------------------------void __fastcall TRefEditForm::WMDropFiles(TWMDropFiles &message){  AnsiString FileName;  FileName.SetLength(MAX_PATH);  int Count = DragQueryFile((HDROP)message.Drop, 0xFFFFFFFF, NULL, MAX_PATH);  // index through the files and query the OS for each file name...  for (int index = 0; index < Count; ++index)  {    // the following code gets the FileName of the dropped file.  I know it    // looks cryptic but that's only because it is.  Hey, Why do you think    // Delphi and C++ Builder are so popular anyway?    FileName.SetLength(DragQueryFile((HDROP)message.Drop, index,      FileName.c_str(), MAX_PATH));    // examine the filename's extension.    // If it's a Word file then ...    if (UpperCase(ExtractFileExt(FileName)) == ".DOC")    {      ListBox_Words->Items->Add(FileName);    }  }  // tell the OS that we're finished...  DragFinish((HDROP) message.Drop);}
开发者ID:DmytroBiriukov,项目名称:RefEditor,代码行数:28,


示例9: onDropFile

/*----------*/void	onDropFile(HDROP hDrop){    DWORD	i, nb, len;    wchar_t	wbuf[MAX_PATH+32];    wchar_t* wp;    nb = DragQueryFile(hDrop, (DWORD)-1, NULL, 0);    for(i = 0 ; i < nb ; i++) {	len = DragQueryFile(hDrop, i, NULL, 0);	if(len < 1 || len > MAX_PATH)	    continue;	wp = wbuf + 1;	if(! DragQueryFile(hDrop, i, wp, MAX_PATH))	    continue;	wp[len] = 0;	while(*wp > 0x20) wp++;	if(*wp) {	    wp = wbuf;	    len++;	    wp[0] = wp[len++] = L'/"';	}	else {	    wp = wbuf + 1;	}	wp[len++] = L' ';	__write_console_input(wp, len);    }    DragFinish(hDrop);}
开发者ID:isseki,项目名称:metacryst,代码行数:31,


示例10: HandleFiles

void HandleFiles(WPARAM wParam) {	// DragQueryFile() takes a LPWSTR for the name so we need a TCHAR string	TCHAR szName[MAX_PATH];	// Here we cast the wParam as a HDROP handle to pass into the next functions	HDROP hDrop = (HDROP)wParam;	// This functions has a couple functionalities.  If you pass in 0xFFFFFFFF in	// the second parameter then it returns the count of how many filers were drag	// and dropped.  Otherwise, the function fills in the szName string array with	// the current file being queried.	int count = DragQueryFile(hDrop, 0xFFFFFFFF, szName, MAX_PATH);	// Here we go through all the files that were drag and dropped then display them	for (int i = 0; i < count; i++)	{		// Grab the name of the file associated with index "i" in the list of files dropped.		// Be sure you know that the name is attached to the FULL path of the file.		DragQueryFile(hDrop, i, szName, MAX_PATH);		// Bring up a message box that displays the current file being processed		MessageBox(GetForegroundWindow(), szName, "Current file received", MB_OK);	}	// Finally, we destroy the HDROP handle so the extra memory	// allocated by the application is released.	DragFinish(hDrop);}
开发者ID:suhockii,项目名称:rsa-encryption,代码行数:29,


示例11: ASSERT

void CFileEditCtrl::OnDropFiles(HDROP hDropInfo) {	// handles drag and drop file entry, control must have the	// WS_EX_ACCEPTFILES extended style set.	CString szSeperator;#if defined FEC_NORESOURCESTRINGS	szSeperator = FEC_IDS_SEPERATOR;#else	szSeperator.LoadString(FEC_IDS_SEPERATOR);#endif	ASSERT (_tcslen(szSeperator) == 1);			// must be one character only	szSeperator += _T(" ");						// get the file seperator character	CString szDroppedFiles;						// buffer to contain all the dropped files	TCHAR lpstrDropBuffer[_MAX_PATH];	UINT nDropCount = DragQueryFile(hDropInfo,0xffffffff,NULL,0);	if (nDropCount && (m_bFindFolder || (!m_bFindFolder && !(m_pCFileDialog->m_ofn.Flags & OFN_ALLOWMULTISELECT))))		nDropCount = 1;	if (nDropCount)	{		DragQueryFile(hDropInfo, 0, lpstrDropBuffer, _MAX_PATH);		szDroppedFiles = lpstrDropBuffer;	}	for (UINT x = 1; x < nDropCount; x++)	{		DragQueryFile(hDropInfo, x, lpstrDropBuffer, _MAX_PATH);		szDroppedFiles += szSeperator;		szDroppedFiles += lpstrDropBuffer;	}	DragFinish (hDropInfo);	SetWindowText (szDroppedFiles);}
开发者ID:moodboom,项目名称:Reusable,代码行数:32,


示例12: DragQueryFile

void CPatchListCtrl::OnDropFiles(HDROP hDropInfo){	UINT nNumFiles = DragQueryFile(hDropInfo, 0xFFFFFFFF, nullptr, 0);	for (UINT i = 0; i < nNumFiles; ++i)	{		CString file;		DragQueryFile(hDropInfo, i, file.GetBufferSetLength(MAX_PATH), MAX_PATH);		file.ReleaseBuffer();		if (PathIsDirectory(file))			continue;		// no duplicates		LVFINDINFO lvInfo;		lvInfo.flags = LVFI_STRING;		lvInfo.psz = file;		if (FindItem(&lvInfo, -1) != -1)			continue;		int index = InsertItem(GetItemCount(), file);		if (index >= 0)			SetCheck(index, true);	}	DragFinish(hDropInfo);	SetColumnWidth(0, LVSCW_AUTOSIZE);}
开发者ID:iamduyu,项目名称:TortoiseGit,代码行数:25,


示例13: GlobalLock

STDMETHODIMP CEsteidShlExt::Initialize (	LPCITEMIDLIST pidlFolder, LPDATAOBJECT pDataObj, HKEY hProgID ){	FORMATETC fmt = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };	STGMEDIUM stg = { TYMED_HGLOBAL };	HDROP     hDrop;	TCHAR szFile[MAX_PATH];	HRESULT hr = S_OK;	m_Files.clear();	// Look for CF_HDROP data in the data object.	if (FAILED(pDataObj->GetData(&fmt, &stg))) {		// Nope! Return an "invalid argument" error back to Explorer.		return E_INVALIDARG;	}	// Get a pointer to the actual data.	hDrop = (HDROP) GlobalLock(stg.hGlobal);	// Make sure it worked.	if (hDrop == NULL) {		ReleaseStgMedium(&stg);		return E_INVALIDARG;	}	// Sanity check - make sure there is at least one filename.	UINT nFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);	if (nFiles == 0) {		GlobalUnlock(stg.hGlobal);		ReleaseStgMedium(&stg);		return E_INVALIDARG;	}	for (UINT i = 0; i < nFiles; i++) {		// Get path length in chars		UINT len = DragQueryFile(hDrop, i, NULL, 0);		if (len == 0 || len >= MAX_PATH)			continue;		// Get the name of the file		if (DragQueryFile(hDrop, i, szFile, len+1) == 0)			continue;		tstring str = tstring(szFile);		if (str.empty())			continue;		m_Files.push_back(str);	}	if (m_Files.empty()) {		// Don't show menu if no items were found		hr = E_INVALIDARG;	}	GlobalUnlock(stg.hGlobal);	ReleaseStgMedium(&stg);	return hr;}
开发者ID:Krabi,项目名称:idkaart_public,代码行数:60,


示例14: DragQueryFile

void __fastcall TfrmMain::WMDropFiles(TWMDropFiles& Message){  int Count = DragQueryFile(reinterpret_cast<void*>(Message.Drop), 0xFFFFFFFF, NULL, 0);  try  {    char FileBuf[MAX_PATH+1];    if (Count > 0)    {      TStringList* FileList = new TStringList();      try      {        for (int i = 0; i < Count; i++)        {          DragQueryFile(reinterpret_cast<void*>(Message.Drop), i, FileBuf, sizeof(FileBuf));          FileList->Add(FileBuf);        }        FileList->Sort();        reSource->Lines->BeginUpdate();        try        {          reSource->Lines->Clear();          for (int i = 0; i < FileList->Count; i++)            reSource->Lines->Add(StringFromFile(FileList->Strings[i]));        }        __finally        {          reSource->Lines->EndUpdate();        }      }      __finally      {        delete FileList;      }    }  } __finally {
开发者ID:chinnyannieb,项目名称:Meus-Projetos,代码行数:35,


示例15: OnDropFiles

void OnDropFiles(HDROP hdrop){	if(!hdrop)		return;	int filesDropped = DragQueryFile(hdrop, 0xffffffff, NULL, 0);	//获取拖拽文件的个数	TCHAR pathDropped[1024];	for(int i = 0; i < filesDropped; ++i)	{		ZeroMemory(pathDropped, sizeof(pathDropped));		DragQueryFile(hdrop, i, pathDropped, 1024);		if (0 == _tcsicmp(::PathFindExtension(pathDropped), TEXT(".bmp")))		{			_tcscpy(pathOut, pathDropped);		}		else		{			::StringCbCopy(pathOut, sizeof(pathOut), pathDropped);			::PathRemoveExtension(pathOut);			::PathAddExtension(pathOut, TEXT(".bmp"));			Png2AlphaBitmap(pathDropped, pathOut);		}	}	DragFinish(hdrop);}
开发者ID:yedaoq,项目名称:YedaoqToolSpace,代码行数:30,


示例16: ase_wnd_proc

static LRESULT CALLBACK ase_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam){  switch (msg) {    case WM_DROPFILES:      {        ScopedLock lock(*dropped_files_mutex);        HDROP hdrop = (HDROP)(wparam);        int index, count, length;        count = DragQueryFile(hdrop, 0xFFFFFFFF, NULL, 0);        for (index=0; index<count; ++index) {          length = DragQueryFile(hdrop, index, NULL, 0);          if (length > 0) {            TCHAR* lpstr = new TCHAR[length+1];            DragQueryFile(hdrop, index, lpstr, length+1);            dropped_files->push_back(lpstr);            delete[] lpstr;          }        }        DragFinish(hdrop);      }      break;  }  return ::CallWindowProc(base_wnd_proc, hwnd, msg, wparam, lparam);}
开发者ID:eledot,项目名称:aseprite,代码行数:28,


示例17: OnDropFiles

void OnDropFiles(HDROP hDrop, HWND hDlg, thread_param* ptp){	struct CB cb;	TCHAR FileName[MAXPATH];	DWORD i;	DWORD FileNum;	cb.cnt = 0;	cb.filter = 0;	cb.ptp = ptp;	GetDlgItemText(hDlg, IDC_EXEPATH, g_ExePath, MAX_PATH);	GetDlgItemText(hDlg, IDC_KEYPATH, g_KeyPath, MAX_PATH);	if (!g_ExePath[0] || !g_KeyPath[0])	{		AppendMsg(L"路径不合法/r/n");		return;	}	FileNum  = DragQueryFile(hDrop, -1, NULL, 0);	for (i=0; i<FileNum; ++i)	{		DragQueryFile(hDrop, i, (LPTSTR)FileName, MAXPATH);		AppendFileToQueue(FileName, callback, &cb);	}	DragFinish(hDrop);	return;}
开发者ID:Kerisa,项目名称:ExtractGames,代码行数:32,


示例18: handle_drop

static voidhandle_drop( HDROP hDrop ){  size_t bufsize;  char *namebuf;  /* Check that only one file was dropped */  if( DragQueryFile( hDrop, ~0UL, NULL, 0 ) == 1) {    bufsize = DragQueryFile( hDrop, 0, NULL, 0 ) + 1;    if( ( namebuf = malloc( bufsize ) ) ) {      DragQueryFile( hDrop, 0, namebuf, bufsize );      fuse_emulation_pause();      utils_open_file( namebuf, tape_can_autoload(), NULL );      free( namebuf );      display_refresh_all();      fuse_emulation_unpause();    }  }  DragFinish( hDrop );}
开发者ID:jacadym,项目名称:fuse-emulator,代码行数:25,


示例19: TreeView_Select

HRESULT FTPWindow::OnDrop(LPDATAOBJECT pDataObj, DWORD /*grfKeyState*/, POINTL /*pt*/, LPDWORD pdwEffect) {	TreeView_Select(m_treeview.GetHWND(), NULL, TVGN_DROPHILITE);	STGMEDIUM medium;	FORMATETC formatetc;	formatetc.cfFormat = CF_HDROP;	formatetc.tymed = TYMED_HGLOBAL;	formatetc.dwAspect = 0;	formatetc.lindex = -1;	formatetc.ptd = NULL;;	HRESULT dataRes = pDataObj->GetData(&formatetc, &medium);	if (dataRes == S_OK) {		*pdwEffect = DROPEFFECT_COPY;		HDROP hdrop = (HDROP)GlobalLock(medium.hGlobal);		TCHAR pathToFile[MAX_PATH];		int filesDropped = DragQueryFile(hdrop, 0xffffffff, NULL, 0);		for (int i = 0; i < filesDropped; ++i) {			if (DragQueryFile(hdrop, i, pathToFile, MAX_PATH) != 0) {				//pathToFile is not checked. If it doesnt exist or its a directory or link, CreateFile either allows a handle to be opened or not				m_ftpSession->UploadFile(pathToFile, m_currentDropObject->GetPath(), true, 1);	//1: User specified location			}		}		GlobalUnlock(medium.hGlobal);		GlobalFree(medium.hGlobal);	}	return S_OK;}
开发者ID:Praymundo,项目名称:NppFTP,代码行数:32,


示例20: GlobalLock

HRESULT CSimpleShlExt::Initialize (LPCITEMIDLIST pidlFolder,								   LPDATAOBJECT pDataObj,								   HKEY hProgID ){	LPTSTR		lpszBuffer;	FORMATETC	fmt = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };	STGMEDIUM	stg = { TYMED_HGLOBAL };	HDROP		hDrop;	UINT		uNumFiles,				i;					// Look for CF_HDROP data in the data object.	if (FAILED( pDataObj->GetData(&fmt, &stg) ))		// Nope! Return an "invalid argument" error back to Explorer.		return E_INVALIDARG;	// Get a pointer to the actual data.	hDrop = (HDROP) GlobalLock ( stg.hGlobal );	// Make sure it worked.	if (hDrop == NULL)		return E_INVALIDARG;	// Get the number of files selected	// and make sure there is at least one file	if ((uNumFiles = DragQueryFile( hDrop, 0xFFFFFFFF, NULL, 0 )) == 0)	{		GlobalUnlock( stg.hGlobal );		ReleaseStgMedium( &stg );		return E_INVALIDARG;	}	// Create buffer	if (m_szFiles != NULL)		delete [] m_szFiles;	m_nFilesLength = 1;	for (i=0; i<uNumFiles; ++i)		m_nFilesLength += DragQueryFile(hDrop, i, NULL, 0) + 1;	lpszBuffer = m_szFiles = new TCHAR[m_nFilesLength];	if (m_szFiles == NULL)	{		GlobalUnlock( stg.hGlobal );		ReleaseStgMedium( &stg );		return E_INVALIDARG;	}	// Append all files into the buffer seperated by '/0'.	for (i=0; i<uNumFiles; ++i)	{		lpszBuffer += DragQueryFile(hDrop, i, lpszBuffer, MAX_PATH);		*lpszBuffer++ = _T('/0');	}	*lpszBuffer = _T('/0');	// End by a double '/0'.	GlobalUnlock ( stg.hGlobal );	ReleaseStgMedium ( &stg );	return S_OK;}
开发者ID:thecocce,项目名称:renameit,代码行数:59,


示例21: AfxMessageBox

void CEzShortcutDlg::OnDropFiles(HDROP hDropInfo){	TCHAR szPathName[MAX_PATH];	// 
C++ DrawArrow函数代码示例
C++ DragFinish函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。