472,779 Members | 1,935 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 software developers and data experts.

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

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
Jul 21 '05 #1
3 9315
Elp
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.
Jul 21 '05 #2
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" <ro********@REMOVEME.hotmail.com> wrote in message
news:1e******************************@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.

Jul 21 '05 #3
jbeyer
1
Elp,

I came across your post through a Google search. I am trying to create a Windows Service that generates keystrokes, namely, a PrtScr keystroke.
I came across the following code to do so:
'The second parameter (bScan) determines what
'to copy... passing 0& copies the screen or
'passing 1& copies the active form.
keybd_event vbKeySnapshot, 0&, 0&, 0&

'pause to let Windows update the clipboard
DoEvents

'retrieve the clipboard bitmap to the control
Image1.Picture = Clipboard.GetData(vbCFBitmap)

The DoEvents command is not available in my service, and without it, the keystroke doesn't seem to be absorbed by Windows.
Do you have any suggestions? Pardon my naivety, I'm a complete newbie to VB.

Cheers,
Jon



On Tue, 15 Feb 2005 08:22:40 -0500, James Dixon wrote:
[color=blue]
> 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.[/color]

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.
[color=blue]
> Is there
> an equivilent function (call the CreateDocumentFromURL from a seperate
> thread and spin it until Document.readyState != "complete"?[/color]

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.
Apr 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: pberna | last post by:
Dear all, I built a Web Form application to start and stop a Windows Service remotely. I successful tested the application on Windows 2000 server + IIS. I must include the ASPNET user to the...
4
by: Jim | last post by:
I am writing a Windows Service in VB.Net, and right upfront I need to pass the path to my config.xml file to the constructor of the class which reads it. In the old days, App.Path & "\config.xml"...
4
by: Blaxer | last post by:
I have read approximately 30 articles now on various methods to make your vb.net application automatically update itself and I can't see how they apply to a vb.net windows services projects. The...
2
by: James Dixon | last post by:
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...
2
by: Ludovic DE FREITAS | last post by:
Hello, I am making a prototype system with a Pocket PC that must connect to a Server Application. Unfortunately, the server cannot be a Web Server, but a simple Windows Forms Application. ...
2
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
2
by: shapper | last post by:
Hello, I usually develop Asp.Net 2.0 (With VB.NET or C#) web sites with SQL 2005 databases. A few of my web sites use online CMS with AJAX. I need to create a Windows Vista compatible...
15
by: =?Utf-8?B?TVNU?= | last post by:
To demonstrate my problem, I have a very simple VB Windows application. It has a text box that is used to display a counter, a button to reset the counter, and a timer that increments the counter...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.