I have an application that uses the Ax web browser object. When I call the
IHTMLElement.click() method on an input button (<input type="submit"> or
<input type="button">), the click fires appropriately, if I'm running it
from a windows forms based application.
However, when I run the EXACT same code under a windows service, either as a
logged in user or as the local system account, the click fails to process.
Clicking on other elements (like <a>) works.
I've tried submitting the form directly, in cases where a submit occurs, but
can't do that either. Both GET and POST actions fail.
What am I doing wrong? Is there something that prohibits the onclick event
from firing for buttons when running as a service? Am I missing something?
Robert 7 4636
Robert,
As a general rule, you should not try and access UI elements from within
a windows service. It's generally a bad idea.
Do you have the service set up to interact with the desktop? If not,
turn this on, and it might work. This would mean that your service would
always have to have a logged in user to run in order to work (and you can't
guarantee that).
To what end are you using the WebBrowser control?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Robert May" <ra****************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... I have an application that uses the Ax web browser object. When I call the IHTMLElement.click() method on an input button (<input type="submit"> or <input type="button">), the click fires appropriately, if I'm running it from a windows forms based application.
However, when I run the EXACT same code under a windows service, either as a logged in user or as the local system account, the click fails to process. Clicking on other elements (like <a>) works.
I've tried submitting the form directly, in cases where a submit occurs, but can't do that either. Both GET and POST actions fail.
What am I doing wrong? Is there something that prohibits the onclick event from firing for buttons when running as a service? Am I missing something?
Robert
Nicholas,
We are gathering the content from various web pages using c# scripts and
don't have the time to write something that would be capable of doing posts
and gets and parsing javascript to determine locations.
We want to have many threads of this automated process. In the future,
we'll write something that doesn't use the webbrowser control because of
issues like this, but we simply didn't have the resources to do so at this
time.
Suggestions?
Robert
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:u7**************@tk2msftngp13.phx.gbl... Robert,
As a general rule, you should not try and access UI elements from within a windows service. It's generally a bad idea.
Do you have the service set up to interact with the desktop? If not, turn this on, and it might work. This would mean that your service would always have to have a logged in user to run in order to work (and you can't guarantee that).
To what end are you using the WebBrowser control?
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Robert May" <ra****************@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...I have an application that uses the Ax web browser object. When I call the IHTMLElement.click() method on an input button (<input type="submit"> or <input type="button">), the click fires appropriately, if I'm running it from a windows forms based application.
However, when I run the EXACT same code under a windows service, either as a logged in user or as the local system account, the click fails to process. Clicking on other elements (like <a>) works.
I've tried submitting the form directly, in cases where a submit occurs, but can't do that either. Both GET and POST actions fail.
What am I doing wrong? Is there something that prohibits the onclick event from firing for buttons when running as a service? Am I missing something?
Robert
Robert,
I think the only other option would be to access MSHTML yourself, and
load the content into there. I don't know if it needs access to the desktop
(it shouldn't, if the host doesn't support it), but you will have to do a
lot of interop to load your documents (depending on where you get them
from).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Robert May" <ra****************@hotmail.com> wrote in message
news:eO****************@TK2MSFTNGP12.phx.gbl... Nicholas,
We are gathering the content from various web pages using c# scripts and don't have the time to write something that would be capable of doing posts and gets and parsing javascript to determine locations.
We want to have many threads of this automated process. In the future, we'll write something that doesn't use the webbrowser control because of issues like this, but we simply didn't have the resources to do so at this time.
Suggestions?
Robert
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:u7**************@tk2msftngp13.phx.gbl... Robert,
As a general rule, you should not try and access UI elements from within a windows service. It's generally a bad idea.
Do you have the service set up to interact with the desktop? If not, turn this on, and it might work. This would mean that your service would always have to have a logged in user to run in order to work (and you can't guarantee that).
To what end are you using the WebBrowser control?
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Robert May" <ra****************@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...I have an application that uses the Ax web browser object. When I call the IHTMLElement.click() method on an input button (<input type="submit"> or <input type="button">), the click fires appropriately, if I'm running it from a windows forms based application.
However, when I run the EXACT same code under a windows service, either as a logged in user or as the local system account, the click fails to process. Clicking on other elements (like <a>) works.
I've tried submitting the form directly, in cases where a submit occurs, but can't do that either. Both GET and POST actions fail.
What am I doing wrong? Is there something that prohibits the onclick event from firing for buttons when running as a service? Am I missing something?
Robert
Nicholas,
We actually ARE using MSHTML. We have the browser navigate, get the doc and
then parse through the document. We're then calling the
IHTMLElement.click() method and expecting this to do the navigation back
with the browser.
Under a windows service, it doesn't work. :( Even if we get the form that
we're trying to submit and call submit, it doesn't work. It's like post
backs are disabled in windows services.
Robert
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:Oe*************@TK2MSFTNGP12.phx.gbl... Robert,
I think the only other option would be to access MSHTML yourself, and load the content into there. I don't know if it needs access to the desktop (it shouldn't, if the host doesn't support it), but you will have to do a lot of interop to load your documents (depending on where you get them from).
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Robert May" <ra****************@hotmail.com> wrote in message news:eO****************@TK2MSFTNGP12.phx.gbl... Nicholas,
We are gathering the content from various web pages using c# scripts and don't have the time to write something that would be capable of doing posts and gets and parsing javascript to determine locations.
We want to have many threads of this automated process. In the future, we'll write something that doesn't use the webbrowser control because of issues like this, but we simply didn't have the resources to do so at this time.
Suggestions?
Robert
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:u7**************@tk2msftngp13.phx.gbl... Robert,
As a general rule, you should not try and access UI elements from within a windows service. It's generally a bad idea.
Do you have the service set up to interact with the desktop? If not, turn this on, and it might work. This would mean that your service would always have to have a logged in user to run in order to work (and you can't guarantee that).
To what end are you using the WebBrowser control?
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Robert May" <ra****************@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... I have an application that uses the Ax web browser object. When I call the IHTMLElement.click() method on an input button (<input type="submit"> or <input type="button">), the click fires appropriately, if I'm running it from a windows forms based application.
However, when I run the EXACT same code under a windows service, either as a logged in user or as the local system account, the click fails to process. Clicking on other elements (like <a>) works.
I've tried submitting the form directly, in cases where a submit occurs, but can't do that either. Both GET and POST actions fail.
What am I doing wrong? Is there something that prohibits the onclick event from firing for buttons when running as a service? Am I missing something?
Robert
Robert,
Yes, you are using MSHTML, but you are getting it from a WebBrowser
control, and I believe that this is the issue. You need to create an
instance of MSHTML.HTMLDocument yourself, and load the content into there.
The document on it's own doesn't require interaction with the desktop (even
though you still have access to javascript events and the like).
You will have to create an IPersistMoniker definition, and then upload
your content through the call to Load. It's a lot of work, but the only way
to untie the document from the visualizer (which is the control).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Robert May" <ra****************@hotmail.com> wrote in message
news:uk**************@TK2MSFTNGP11.phx.gbl... Nicholas,
We actually ARE using MSHTML. We have the browser navigate, get the doc and then parse through the document. We're then calling the IHTMLElement.click() method and expecting this to do the navigation back with the browser.
Under a windows service, it doesn't work. :( Even if we get the form that we're trying to submit and call submit, it doesn't work. It's like post backs are disabled in windows services.
Robert
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:Oe*************@TK2MSFTNGP12.phx.gbl... Robert,
I think the only other option would be to access MSHTML yourself, and load the content into there. I don't know if it needs access to the desktop (it shouldn't, if the host doesn't support it), but you will have to do a lot of interop to load your documents (depending on where you get them from).
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Robert May" <ra****************@hotmail.com> wrote in message news:eO****************@TK2MSFTNGP12.phx.gbl... Nicholas,
We are gathering the content from various web pages using c# scripts and don't have the time to write something that would be capable of doing posts and gets and parsing javascript to determine locations.
We want to have many threads of this automated process. In the future, we'll write something that doesn't use the webbrowser control because of issues like this, but we simply didn't have the resources to do so at this time.
Suggestions?
Robert
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:u7**************@tk2msftngp13.phx.gbl... Robert,
As a general rule, you should not try and access UI elements from within a windows service. It's generally a bad idea.
Do you have the service set up to interact with the desktop? If not, turn this on, and it might work. This would mean that your service would always have to have a logged in user to run in order to work (and you can't guarantee that).
To what end are you using the WebBrowser control?
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Robert May" <ra****************@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... >I have an application that uses the Ax web browser object. When I call >the > IHTMLElement.click() method on an input button (<input type="submit"> > or > <input type="button">), the click fires appropriately, if I'm running > it > from a windows forms based application. > > However, when I run the EXACT same code under a windows service, > either as a > logged in user or as the local system account, the click fails to > process. > Clicking on other elements (like <a>) works. > > I've tried submitting the form directly, in cases where a submit > occurs, but > can't do that either. Both GET and POST actions fail. > > What am I doing wrong? Is there something that prohibits the onclick > event > from firing for buttons when running as a service? Am I missing > something? > > Robert > > >
Hi Nicholas, Yes, you are using MSHTML, but you are getting it from a WebBrowser control, and I believe that this is the issue. You need to create an instance of MSHTML.HTMLDocument yourself, and load the content into there. The document on it's own doesn't require interaction with the desktop (even though you still have access to javascript events and the like).
You will have to create an IPersistMoniker definition, and then upload your content through the call to Load. It's a lot of work, but the only way to untie the document from the visualizer (which is the control).
That's a good starting point:
"Writer", hosted on the GotDotNet Workplaces.
Quite high quality [Lutz Roeder ("Reflector") is involved].
Another project: http://www.itwriting.com/htmleditor/index.php
As far I can recall, the project embeds MSHTML exactly as you
recommend, but I don't think that IPersistMoniker is used.
bye
Rob
Robert,
This is definitely a good place to start. Granted, you won't want to
provide the visual elements in hosting (because I assume that would bring
you back to the same problem you had before), but it will show you how to
host MSHTML.
Check out the section of MSDN titled "Reusing MSHTML", located at (watch
for line wrap): http://msdn.microsoft.com/library/de...ng/hosting.asp
It will give you a good idea of where to start. Everything is done in
C++, but can be converted to interop calls.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Robert Jordan" <ro*****@gmx.net> wrote in message
news:cl*************@news.t-online.com... Hi Nicholas,
Yes, you are using MSHTML, but you are getting it from a WebBrowser control, and I believe that this is the issue. You need to create an instance of MSHTML.HTMLDocument yourself, and load the content into there. The document on it's own doesn't require interaction with the desktop (even though you still have access to javascript events and the like).
You will have to create an IPersistMoniker definition, and then upload your content through the call to Load. It's a lot of work, but the only way to untie the document from the visualizer (which is the control).
That's a good starting point:
"Writer", hosted on the GotDotNet Workplaces. Quite high quality [Lutz Roeder ("Reflector") is involved].
Another project:
http://www.itwriting.com/htmleditor/index.php
As far I can recall, the project embeds MSHTML exactly as you recommend, but I don't think that IPersistMoniker is used.
bye Rob This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mat |
last post by:
Hi all.
I need to build a little HTML parser. I made 2 versions, for console e for
window.
In console mode it seems to work (but not always, sometimes it doesn't parse
the HTML file), in window...
|
by: Todd Schinell |
last post by:
Back in July, Jeffery Tan posted this:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=OWOTdf0VDHA.2296%40cpmsftngxa06.phx.gbl
In response as to how to get click events from a...
|
by: Sunny |
last post by:
Hi all,
dev. env.: VS.Net2003/C#
I have a windows form application with web browser control. I need to
capture the onsubmit event of the forms in the document in order to get
the values and log...
|
by: Robert May |
last post by:
I have an application that uses the Ax web browser object. When I call the
IHTMLElement.click() method on an input button (<input type="submit"> or
<input type="button">), the click fires...
|
by: Mark Nijhof |
last post by:
Hi,
A quicke summarize:
I made a windows form that can set up a socket connection. It also has
events that fire when data arives. Now I am using this form in a hidden
way inside other code (was...
|
by: Giuseppe |
last post by:
Hi
I've this problem
Inside a winform application I've put a "webbrowser" control
I've tried to catch the oncontextmenu event of the loaded HTML document with the following
approach
1) In...
|
by: miktro |
last post by:
I have an VB.Net desktop application where I am hosting a WebBrowser.
I need to interact with the events in the browser.
I encountered the normal problem of, after adding events the normal click...
|
by: NG |
last post by:
Hi All
This is a post further to my previous problem that I solved with the help of
my friends at csharp group.
I have a UI application that has a web-browser. When this application is
run...
|
by: nickin4u |
last post by:
I have a application that is used to automate certain task,
I have been using mshtml.HTMLDocument class but certain events like click a button do not fire. I have tried a number of combinations but...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |