473,403 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 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 9380
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.