Microsoft.mshtml execCommand("Copy", false, null) returns false on Windows 2012 Server -
i using following code save image c# webbrowser control in windows forms application. use microsoft.mshtml ihtmldocument2 achieve this
the following code works fine in windows 8 pc not working in windows 2012 server while running on server 'imgrange.execcommand("copy", false, null);' returns false. , 'bmp' null causing null reference exception.
i have google search , did not find solution.
anybody please help.. many thanks
ihtmldocument2 doc =(ihtmldocument2)webbrowser.document.domdocument; ihtmlcontrolrange imgrange = (ihtmlcontrolrange((htmlbody)doc.body).createcontrolrange(); foreach (ihtmlimgelement img in doc.images) { if (img.src == "image url") //identify image { imgrange.add((ihtmlcontrolelement)img); **imgrange.execcommand("copy", false, null);** //returns false in 2012 server using (bitmap bmp = (bitmap)clipboard.getdataobject().getdata(dataformats.bitmap)) { bmp.save("filename.png"); } } }
Comments
Post a Comment