Vista & C # - drag and drop problem (not related to zoom)

The statement in question is the .Net 2.0 Framework WinForms. It should work on a large user base (installation from a CD). Installation is done using InnoSetup.

On two machines, the application does not accept Drag and Drop (both applications and the D & D source have the same level of height).

By adding Read and Read & Execute INTERACTIVE SID permissions to the application shortcut, this problem seems to be resolved.

Question: how are these rights and D&D related and how to check / install these rights during the installation process?

+6
c # winforms drag-and-drop inno-setup
source share
3 answers

You have two questions:

  • how adding these rights and D&D are related and ...

I’m not at all sure. We use D & D in our WinForm application for / from the shell and Outlook without any problems in Vista. I’m not even sure that the change in ACL that you propose will surely fix any problem you encounter.

  1. How to check / install these rights during the installation process?

The easiest way to do this is to create an installation class. Net and add the following code:

public static void ReplacePermissions(string filepath, WellKnownSidType sidType, FileSystemRights allow) { FileSecurity sec = File.GetAccessControl(filepath); SecurityIdentifier sid = new SecurityIdentifier(sidType, null); sec.PurgeAccessRules(sid); //remove existing sec.AddAccessRule(new FileSystemAccessRule(sid, allow, AccessControlType.Allow)); File.SetAccessControl(filepath, sec); } 
+1
source share

Just a shot in the dark, but is there a [STAThread] attribute in your Main () application? Without it, drag and drop will not work at all. (Although this does not explain the behavior change with the change of rights to the INTERACTIVE SID).

0
source share

You must run the exe file for the project directly and outside of Visual Studio. I am running on Windows Vista.

0
source share

All Articles