views:

88

answers:

4

Okay, so originally I was going to ask about dragging and dropping in Windows 7. I found the answer I was looking for here: http://stackoverflow.com/questions/2833709/c-drag-drop-does-not-work-on-windows-7. Basically it says that since I'm running Visual Studio (and subsequently, my program) with elevated permissions, some sort of isolation layer prevents me from dragging and dropping files from explorer into my program.

The reason I run visual studio with elevated permissions is because admin privileges are needed to run a site locally on IIS and the web app is in my solution. Is there a way I can tell visual studio to run and debug my other apps as a normal user?

+2  A: 

Why don't you just create another short-cut on the desktop that starts devenv.exe without elevation?

Hans Passant
+1  A: 
Richard
Rereading my question, it does seem a bit confusing. I'm not asking about running a web app. The web app is merely the reason I need to run VS as admin. What I'm trying to do is debug a windows form application that is also part of the solution.
Jason Thompson
+1  A: 

MSDN states:

Launching an Un-Elevated Application from an Elevated Process

A frequently asked question is how to launch an un-elevated application from an elevated process, or more fundamentally, how to I launch a process using my un-elevated token once I’m running elevated. Since there is no direct way to do this, the situation can usually be avoided by launching the original application as standard user and only elevating those portions of the application that require administrative rights. This way there is always a non-elevated process that can be used to launch additional applications as the currently logged on desktop user. Sometimes, however, an elevated process needs to get another application running un-elevated. This can be accomplished by using the task scheduler within Windows Vista®. The elevated process can register a task to run as the currently logged on desktop user.

You could use that and implement a simple launcher app (possibly a VS macro) that you start instead of your application. The launcher app would:

  • Create a scheduled task that would run immediately or that is triggered by an event
  • Start the debuggee
  • Connect the VS debugger to the started process
0xA3
+1  A: 

From your application, call ChangeWindowMessageFilter with the following values to allow dragging and dropping to/from your elevated application and non-elevated applications like Explorer:

ChangeWindowMessageFilter (WM_DROPFILES, MSGFLT_ADD);
ChangeWindowMessageFilter (WM_COPYDATA, MSGFLT_ADD);
ChangeWindowMessageFilter (0x0049, MSGFLT_ADD);

Credit: http://blog.helgeklein.com/2010/03/how-to-enable-drag-and-drop-for.html

dmex