Windows Service - need Windows.Forms.Application.DoEvent() equiv

  • Thread starter Thread starter James Dixon
  • Start date Start date
J

James Dixon

I have created a windows service in C#, .net framework 1.1

The service makes a web request using the
mshtml.HTMLDocument.CreateDocumentFromURL() function

Because this is not using Windows.Forms, I can't use the
Application.DoEvents() function while the request is completing. Is there
an equivilent function (call the CreateDocumentFromURL from a seperate
thread and spin it until Document.readyState != "complete"?

Or just use Windows Forms namespace to access the Application object?

thanks
 
I have created a windows service in C#, .net framework 1.1

The service makes a web request using the
mshtml.HTMLDocument.CreateDocumentFromURL() function

Because this is not using Windows.Forms, I can't use the
Application.DoEvents() function while the request is completing.

Why do you need to call DoEvents from a Windows Service? All that DoEvent
does is to tell your application's Windows to process events from the
message loop (those events can be eg Repaint Window or Move Window). In a
windows service you have no user interface, no windows and no message loop
so DoEvents won't do anything.
Is there
an equivilent function (call the CreateDocumentFromURL from a seperate
thread and spin it until Document.readyState != "complete"?

You could maybe precise a bit more what you are trying to achieve. I don't
see the point of launching a new thread and then simply loop until this
thread has finished its job. Use threads only if you need to do several
things in parallel.
 
I didn't know if the HTMLDocument needs some kind of external notification
to finish
so I'll just do this:
while (objDocument.readyState != "complete")

{

// Application.DoEvents();

}


and when it is done looping, I can start parsing the doc
I'll let you know if it works

thanks
 
Back
Top