none
Drag&Drop won't work, when app executed "Run as administrator"

    Question

  • Hi all,

    I am developing some applications (Windows Forms application) with VB.net.
    Some of them need Drag&Drop operation.
    D&D can work when executed as normal user. But D&D won't work when it is "run as Administrator".

    With Visual Studio,  these lines are in "app.manifest".
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
      </requestedPrivileges>. 
    With the above description, D&D does work fine.

    On the other hand, D&D won't work with the below.
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
         (instead of [level="asInvoker"])

    What or How should I do in order to make an app that has Drag&Drop feature and "run as administrator"?

    Best regards,
    Ashidacchi



    • Edited by Ashidacchi Tuesday, March 28, 2017 12:49 AM
    Tuesday, March 28, 2017 12:16 AM

Answers

  • The reason why I intended to make my application higher privileged is:
    When it is installed in such folder as required Admin privilege like "C:\Program Files", I could not save a file in that folder.

    In that case the best solution is to run your app at the lower privilege level, and save you data to a folder which is not secured.  The best choice for application-specific data is the applicationdata special folder. You can reference it using the environment.specialfolder enumeration, so there is no need to know the actual folder name.  See:
    https://msdn.microsoft.com/en-us/library/system.environment.specialfolder(v=vs.110).aspx 


    • Edited by AcamarMVP Tuesday, March 28, 2017 4:38 AM sp
    • Marked as answer by Ashidacchi Tuesday, March 28, 2017 5:34 AM
    Tuesday, March 28, 2017 4:38 AM

All replies

  • What or How should I do in order to make an app that has Drag&Drop feature and "run as administrator"?

    With that change you are running the app at a different privilege level than the drag and drop source. See here for a full description:

    https://blogs.msdn.microsoft.com/patricka/2010/01/28/q-why-doesnt-drag-and-drop-work-when-my-application-is-running-elevated-a-mandatory-integrity-control-and-uipi/

    Tuesday, March 28, 2017 1:23 AM
  • Hi Acamar,

    Thank you for your quick reply/suggestion.

    The reason why I intended to make my application higher privileged is:
    When it is installed in such folder as required Admin privilege like "C:\Program Files", I could not save a file in that folder.  So, I wanted to run my app as administrator.

    I think it is better to run as normal privilege (it enables Drag&Drop) and to give it higher privilege only when a file is saved. Alas, I do not know how.

    I will try to think about the better way.Thanks again. 
    Tuesday, March 28, 2017 3:14 AM
  • The reason why I intended to make my application higher privileged is:
    When it is installed in such folder as required Admin privilege like "C:\Program Files", I could not save a file in that folder.

    In that case the best solution is to run your app at the lower privilege level, and save you data to a folder which is not secured.  The best choice for application-specific data is the applicationdata special folder. You can reference it using the environment.specialfolder enumeration, so there is no need to know the actual folder name.  See:
    https://msdn.microsoft.com/en-us/library/system.environment.specialfolder(v=vs.110).aspx 


    • Edited by AcamarMVP Tuesday, March 28, 2017 4:38 AM sp
    • Marked as answer by Ashidacchi Tuesday, March 28, 2017 5:34 AM
    Tuesday, March 28, 2017 4:38 AM
  • In that case the best solution is to run your app at the lower privilege level, and save you data to a folder which is not secured.  The best choice for application-specific data is the applicationdata special folder.  

    Hello Acamar,

    I can understand your suggestion (the best solution is...), and I will follow it.

    Thank you, again.

    Best regards,
    Ashidacchi
    Tuesday, March 28, 2017 5:37 AM