[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
STDMETHODIMP CSendToShlExt::DragEnter (
DWORD* pdwEffect )
AFX_MANAGE_STATE(AfxGetStaticModuleState()); // init MFC
dataobj.Attach ( pDataObj, FALSE );
// Read the list of items from the data object. They're stored in HDROP
// form, so just get the HDROP handle and then use the drag 'n' drop APIs
// on it.
hglobal = dataobj.GetGlobalData ( CF_HDROP );
if ( NULL != hglobal )
hdrop = (HDROP) GlobalLock ( hglobal );
uNumFiles = DragQueryFile ( hdrop, 0xFFFFFFFF, NULL, 0 );
for ( UINT uFile = 0; uFile < uNumFiles; uFile++ )
if ( 0 != DragQueryFile ( hdrop, uFile, szItem, MAX_PATH ))
m_lsDroppedFiles.AddTail ( szItem );
GlobalUnlock ( hglobal );
Open in new window
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.
TextBox1.AllowDrop = true;
TextBox1.PreviewDragEnter += TextBox1_DragEnter;
private void TextBox1_DragEnter(object sender, DragEventArgs e)
Label1.Content = string.Empty;
if (e.Data.GetDataPresent(DataFormats.FileDrop, true))
string filenames = (string)e.Data.GetData(DataFormats.FileDrop, true);
foreach (string filename in filenames)
Label1.Content += filename + " ";
e.Effects = DragDropEffects.All;
e.Handled = true;
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.