How To drag images directly from Camera or Smartphone to C# app? -


i found script (http://www.codeproject.com/articles/28209/outlook-drag-and-drop-in-c) makes possible drag images c# application. (especially outlook) filedrop format used copy (drag) images hard disk c# app. works when images stored on hard disk, when try drag images directly storage card (from camera or smartphone (like samsung s3)) won't work. these drag formats i'm getting image(s):

(0): "shell idlist array" (1): "filecontents" (2): "filegroupdescriptorw" (3): "wpd storage attributes" (4): "preferred dropeffect" (5): "wpd nse" (6): "wpd nse pnpdevicepath" (7): "wpd nse storagepuid" (8): "usingdefaultdragimage" (9): "dragimagebits" (10): "dragcontext" (11): "dragsourcehelperflags" (12): "inshelldragloop" (13): "isshowinglayered" (14): "dragwindow" (15): "iscomputingimage" (16): "dataobjectattributes" (17): "disabledragtext" (18): "isshowingtext" (19): "dropdescription" (20): "computeddragimage" (21): "logical performed dropeffect" (22): "performed dropeffect" (23): "paste succeeded" 

when try access 'filegroupdescriptorw' i'm receiving illegal access violation error. also, 'filegroupdescriptor' seems missing here? me resolve issue? searched site , google, didn't find useful.

the solution posted john schroedl , hidden in many reactions on topic.

these 2 'fixes' fixed problem:

http://www.codeproject.com/articles/28209/outlook-drag-and-drop-in-c?msg=3535951#xx3535951xx

old c#:

[structlayout(layoutkind.sequential, charset = charset.ansi)] public sealed class filegroupdescriptora {     public uint citems;     public filedescriptora[] fgd; }  [structlayout(layoutkind.sequential, charset = charset.unicode)] public sealed class filegroupdescriptorw {     public uint citems;     public filedescriptorw[] fgd; } 

fixed c#:

[structlayout(layoutkind.sequential, charset = charset.ansi)] public sealed class filegroupdescriptora {     public uint citems;     public filedescriptora fgd; }  [structlayout(layoutkind.sequential, charset = charset.unicode)] public sealed class filegroupdescriptorw {     public uint citems;     public filedescriptorw fgd; } 

and fix: http://www.codeproject.com/articles/28209/outlook-drag-and-drop-in-c?msg=3551197#xx3551197xx

old:

case "filecontents":     //override default handling of filecontents returns     //contents of first file memory stream , instead return     //a array of memorystreams containing data each file dropped      //get array of filenames lets know how many file contents exist     string[] filecontentnames = (string[])this.getdata("filegroupdescriptor"); 

fix:

case "filecontents":     //override default handling of filecontents returns     //contents of first file memory stream , instead return     //a array of memorystreams containing data each file dropped     //     // filecontents requires companion filegroupdescriptor     // available bail out if don't find 1 in data object.      string fgdformatname;      if (getdatapresent("filegroupdescriptorw"))         fgdformatname = "filegroupdescriptorw";     else if (getdatapresent("filegroupdescriptor"))         fgdformatname = "filegroupdescriptor";     else         return null;      //get array of filenames lets know how many file contents exist     string[] filecontentnames = (string[])this.getdata(fgdformatname); 

in case needs it...


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -