Click here to Skip to main content
14,026,166 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am working in C++ Win32 Application and I implementing DragAndDrop operation, I can able to drag a files and folders from explorer to my application using WndProc calls with WM_DROPFILES, Now I trying for DragAndDrop files and folders from Win32 application to explorer.
can some one help me to implement in c++?

What I have tried:

I am using Interfaces I data object ,I data source,I data droptarget.
Updated 24-Jan-19 0:46am
Richard MacCutchan 24-Jan-19 4:59am
What exactly is the problem?
Member 14075717 24-Jan-19 5:37am
I have to implement the drag and drop feature for win32 api application in c++. For drop i have message(WM_DROPFILES)( but to drag files i don't have any messsage so i'm trying using DODRAGDROP API but I am facing problem to implementing it .So can you please help me to implement using the DODRAGDROP or any other way of doing it in C++ .

Thanks in advance

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Member 14075717 24-Jan-19 7:25am
HI can i use the same API'S FOR WIN32 Application which they are used in the above code sample which is implemented for MFC application?
Richard MacCutchan 24-Jan-19 7:55am
The article explains what is needed to create a dropfiles list which can be sent to Explorer. Although the application is written in MFC the actual droplist creation and adding to the clipboard uses standard Win32 features. The only part you need to change is to use an ordinary character array, or std::string, for the list of filenames.
Member 11393783 11-Mar-19 7:29am
Hi ,

We tried implementing IdataObject and IdropSource and how to fill the file details in the FORMATETC and etc.. Please help with this.

Written some code in C. How to calll the shellAPI's in CPP code.

pITEMDLIST_File = ILCreateFromPath(fName);
					if (!pITEMDLIST_File)
						return 0;

					iResu = SHBindToParent(pITEMDLIST_File, &IID_IShellFolder, (void**)&pFolder, (PCUITEMID_CHILD*)&pFile_list_relative);
					if (iResu != S_OK)
						return 0;

					pArray[0] = pFile_list_relative;
					iResu = IShellFolder_GetUIObjectOf(pFolder, NULL, 1, pArray, riid, NULL, (void**)&pInterfaceResu);
					if (iResu != S_OK)
						return 0;


					//return pInterfaceResu;
					pObj = (IDataObject*)pInterfaceResu;

				if (!pObj)

				pSrc = _CreateDropSource();
				if (!pSrc)



This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.190419.4 | Last Updated 24 Jan 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100