|
From: James Dixon on 15 Feb 2005 08:22 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
From: Elp on 15 Feb 2005 08:31 On Tue, 15 Feb 2005 08:22:40 -0500, James Dixon wrote: > 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.
From: James Dixon on 15 Feb 2005 09:05 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 "Elp" <rockfamily(a)REMOVEME.hotmail.com> wrote in message news:1e1f2x7sl2ycv$.h934exssyp6v$.dlg(a)40tude.net... > On Tue, 15 Feb 2005 08:22:40 -0500, James Dixon wrote: > > > 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.
|
Pages: 1 Prev: Oracle OleDb Next: Microsoft: Help with OLE documents... |