mary

mary

  • NA
  • 5
  • 0

Webbrowser in web service problem

Dec 6 2011 7:11 AM
Hi,

I am using webbrowser control in C# . And calling that webbrowser in web service. when i want print from Html Page use of
following code:
  const short PRINT_WAITFORCOMPLETION = 2;
  const int OLECMDID_PRINT = 6;
  const int OLECMDEXECOPT_DONTPROMPTUSER = 2;
  var browser = new WebBrowser();
  browser = Browser;
  while (browser.ReadyState != WebBrowserReadyState.Complete)
  Application.DoEvents();
  dynamic ie = browser.ActiveXInstance;
  HtmlDocument htmld = (HtmlDocument)browser.Document;
  htmld .Body.InnerHtml = HtmlDoc;
  ie.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, PRINT_WAITFORCOMPLETION);
I get the following error:
"TargetInvocation exception" and "Unable to get window handle for WebBrowser Control. Windowless ActiveX control not Supported"

Please Help how to resolve it.

Answers (2)