c# - Old drag and drop code no longer works in windows 7 -
i have code allows me drag , drop hyperlink webpage onto windows form, , seperates url , title , puts them in 2 different text boxes.
this works on windows xp fine, on windows 7 no longer works. i'm not sure difference lies.
object data = e.data.getdata("uniformresourcelocator"); data null, when use
string[] fmts = e.data.getformats(); one of fmts uniformresourcelocator, along bunch of other ones can never seem data from. if has resources point me or appreciate it, confusing me.
thanks.
update:added method code used work
string hyperlinkurl = null; string hyperlinktext = null; hyperlinkurl = e.data.getdata(typeof(string)) string; // browser deliver url , text // in uniformresourcelocator (firebird) string[] tokens = null; if (hyperlinkurl != null) { tokens = hyperlinkurl.split('\n'); } if (tokens != null && tokens.length > 1) { hyperlinkurl = tokens[0]; hyperlinktext = tokens[1]; } // have read filegroupdescriptor text (ie) else { system.io.stream iostream = (system.io.stream)e.data.getdata("filegroupdescriptor"); byte[] contents = new byte[512]; try { iostream.read(contents, 0, 512); } catch (exception x) { } iostream.close(); system.text.stringbuilder sb = new system.text.stringbuilder(); //the magic number 76 size of part of //filegroupdescriptor structure before // filename starts - cribbed //from usenet post. (int = 76; contents[i] != 0; i++) { sb.append((char)contents[i]); } if (!sb.tostring(sb.length - 4, 4).tolower().equals(".url")) { throw new exception("filename not end in '.url'"); } hyperlinktext = sb.tostring(0, sb.length - 4); } tblinktitle.text = hyperlinktext; tblinkaddress.text = hyperlinkurl;
drag , drop hyperlink webpage
that page wouldn't in web browser running in low integrity (e.g. ie protected mode), it? drag-and-drop doesn't work across integrity levels.
what happens if use icacls set executable's integrity level low well? if drag-and-drop starts working, problem.
Comments
Post a Comment