Re: WM_DROPFILES
"Tom Serface" <tom.nospam@camaswood.com> wrote in message
news:CB116214-75F7-4285-9465-974B74863A3F@microsoft.com...
Hi Dave,
The problem I've seen is that I have to run Explorer and my application as
the same privileges or else have UAC off. If I run my application from
Visual Studio it starts up as Administrator (since I use David Ching's
great suggestion to change the shortcut privileges). If I simply start
the Explorer I can't drag and drop files, but if I right click and say
"Start as administrator" it works fine. I think this is a klunky
interface for Vista, but it is easy to work around.
Tom
Yes, with UAC on, it prohibits you dropping a file into an elevated app
(which your app is, since it was started by the elevated Visual Studio) that
is sourced from a non-elevated app (which Explorer is). I guess MS thought
most apps would be running non-elevated, so drag and drop would work amongst
them. I would disable UAC to see if drag and drop works.
Instead of calling
CMyDialog::OnInitDialog()
{
m_ListBox.DragAcceptFile();
...
}
call
CMyDialog::OnInitDialog()
{
DragAcceptFiles();
}
and call
void CMyDialog::OnDestroy()
{
CDialog::OnDestroy();
// Not sure if this is necessary, but it prevents bogus drop messages after
we are gone
DragAcceptFiles(FALSE);
}
You may also want to handle:
// The system calls this to obtain the cursor to display while the user
drags
// the minimized window.
HCURSOR CMyDialog::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
-- David