473,698 Members | 2,616 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Event fired by "alert"

I'm looking for the event that is fired by Internet Explorer to an "alert":

<SCRIPT>
Alert("You already have a session open")
</SCRIPT>

The event would be webBrowser.Docu ment.????

Much appreciate any help you can give me.
Thanks,
Alistair Saldanha

Jul 24 '05 #1
11 4579


Ahhhhhh, what!?

Danny
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jul 25 '05 #2
Lee
Danny said:

Ahhhhhh, what!?


That's a rather useless post, wasting the time of everyone who
reads it. You could have asked clarifying questions, or pointed
out specific misconceptions. In any case, I would hope that you
would also quote enough of the post that you were responding to
to allow others to know what you're questioning.

Jul 25 '05 #3
I am the person who made the original post. I didn't want to make my message
too long but it may have been too brief. I'm using Visual Basic to control a
WebBrowser control on a Visual Basic form through automation. For instance,
if someone clicks a button named Xbutton in Internet Explorer the Visual
Basic code would be:

WebBrowser.Docu ment.All("Xbutt on").OnClick = Class1

This will run the default method in Class1 when the user clicks Xbutton.

I'm looking for the same pathway for an alert:

<SCRIPT>
Alert("You already have a session open")
</SCRIPT>

I'm assuming the pathway would be something along the lines of:

WebBrowser.Docu ment.All("???") = Class2

Thanks,
Alistair
"Alistair Saldanha" <di******@cox.n et> wrote in message
news:KXUEe.2741 0$mC.13022@okep read07...
I'm looking for the event that is fired by Internet Explorer to an
"alert":

<SCRIPT>
Alert("You already have a session open")
</SCRIPT>

The event would be webBrowser.Docu ment.????

Much appreciate any help you can give me.
Thanks,
Alistair Saldanha

Jul 25 '05 #4
VK


Alistair Saldanha wrote:
I am the person who made the original post. I didn't want to make my message
too long but it may have been too brief. I'm using Visual Basic to control a
WebBrowser control on a Visual Basic form through automation. For instance,
if someone clicks a button named Xbutton in Internet Explorer the Visual
Basic code would be:

WebBrowser.Docu ment.All("Xbutt on").OnClick = Class1

This will run the default method in Class1 when the user clicks Xbutton.

I'm looking for the same pathway for an alert:

<SCRIPT>
Alert("You already have a session open")
</SCRIPT>

I'm assuming the pathway would be something along the lines of:

WebBrowser.Docu ment.All("???") = Class2

Thanks,
Alistair


window.alert() is a method of the window object. It is not an event and
it doesn't fire any particular event. As on alert display focus goes to
the alert window, the parent window generates unload event. But it is
useless because unload may be caused by too many reasons.

Also window.alert is what we would call "final class" in other
languages. Thus it doesn't allow to change it's constructor to add
extra property/methods.

Alert doesn't appear automatically, but always has to be explicetly
called in the code. So what does prevent you from:

function foo() {
alert(message);
otherFunction() ;
}

?

Jul 25 '05 #5
VK wrote:
window.alert() is a method of the window object. It is not an event and
it doesn't fire any particular event. As on alert display focus goes to
the alert window, the parent window generates unload event. But it is
useless because unload may be caused by too many reasons.

Also window.alert is what we would call "final class" in other
languages. Thus it doesn't allow to change it's constructor to add
extra property/methods.

Alert doesn't appear automatically, but always has to be explicetly
called in the code. So what does prevent you from:

function foo() {
alert(message);
otherFunction() ;
}

?


How is alert a class? Final or otherwise? It's no more a class than,
say, setsockopt, or document.write, or print or echo.

Also, I think you may have gotten blur and unload confused. unload is
fired only when the current document is unloaded, i.e. when navigating
away from the document, or when closing the browser window. alert
causes the window (and children) to lose focus, causing a blur event,
not an unload.

Hope that clarifies it a bit.

Jul 25 '05 #6
Alistair Saldanha wrote:
I am the person who made the original post. I didn't want to make my message
too long but it may have been too brief. I'm using Visual Basic to control a
WebBrowser control on a Visual Basic form through automation. For instance,


As I understand it, within your VB code you want to be able to react to
an alert message being popped up, presumably by sending a keystroke to
it to dismiss it (or maybe even choose between options or enter input).
I suspect it would be too difficult to guess that the alert is coming
up and then spew a key to dismiss it.

This question is quite interesting, however, and I think it is better
addressed in the newsgroup: microsoft.publi c.vb.winapi
In particular, I think the call you are looking for is the windows API
SetWindowsHookE x with either WH_CBT (more probably) or WH_SHELL,
probably requiring a DLL. The class of the alert/confirm/prompt
(common dialog) windows are all "#32770" and alert has a single OK
button is a subwindow (class "Button"), while the other two each have
an OK and Cancel button, but the prompt window also has an Edit class
subwindow.

You might do a google search on: "32770" SetWindowsHookE x
Here's a useful page with some ideas:
http://groups-beta.google.com/group/...9d4612fdaec9f/

I'll look forward to seeing more on this topic,
Csaba Gabor from Vienna

Jul 25 '05 #7
Csaba Gabor wrote:
Alistair Saldanha wrote:
I am the person who made the original post. I didn't want to make my message
too long but it may have been too brief. I'm using Visual Basic to control a
WebBrowser control on a Visual Basic form through automation. For instance,


As I understand it, within your VB code you want to be able to react to
an alert message being popped up, presumably by sending a keystroke to
it to dismiss it (or maybe even choose between options or enter input).
I suspect it would be too difficult to guess that the alert is coming
up and then spew a key to dismiss it.


Just a thought-- I don't know whether or not this is even possible from
a VB app, but it would seem easiest to replace the window.alert method
with a no-op.

window.alert = function () { };

Don't know if you can do that, but if you can, do.

Jul 25 '05 #8
Christopher J. Hahn wrote:
Just a thought-- I don't know whether or not this is even possible from
a VB app, but it would seem easiest to replace the window.alert method
with a no-op.

window.alert = function () { };

Don't know if you can do that, but if you can, do.


Wow, Great idea!
<body onload="revamp( )">
<script type='text/javascript'>
function revamp() {
// revamp the default alert function
var oldAlert = window.alert;
window.alert = function(alertM sg) {
window.status = alertMsg;
}

// proof of concept
alert("Hi mom");
oldAlert ("Hi dad");
// alert(""); // reset the status bar
}
</script>
</body>

And yes, you can do this from VB with:
IE.document.par entWindow.execS cript _
"window.alert=f unction(alertMs g) {window.status= alertMsg;}"

Side note. If you're going to be creating variables off IE's
document that you can access from VB, I recommend doing
something to create it first like:
IE.document.par entWindow.execS cript "window.myVar=0 "
which will allocate the variable for use

Csaba Gabor from Vienna
PS. I didn't test this on the VB side, but I do it in other situations

Jul 25 '05 #9
Csaba,

Thank you so much for your post.

I cannot change the code in the WebBrowser, I am helping the end user react
to the WebBrowser using Visual Basic automation. The Visual Basic Automation
automatically enters the account number and other details so the end user
doesn't have to enter them manually. What's killing the VB automation are
the consant messages that pop up saying "Another session is running", which
is actually a bug in the WebBrowser coding, but it stops the VB automation
cold. So I'm hoping to do something to sidestep the alerts.

Alistair
"Csaba Gabor" <Cs***@z6.com > wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Alistair Saldanha wrote:
I am the person who made the original post. I didn't want to make my
message
too long but it may have been too brief. I'm using Visual Basic to
control a
WebBrowser control on a Visual Basic form through automation. For
instance,


As I understand it, within your VB code you want to be able to react to
an alert message being popped up, presumably by sending a keystroke to
it to dismiss it (or maybe even choose between options or enter input).
I suspect it would be too difficult to guess that the alert is coming
up and then spew a key to dismiss it.

This question is quite interesting, however, and I think it is better
addressed in the newsgroup: microsoft.publi c.vb.winapi
In particular, I think the call you are looking for is the windows API
SetWindowsHookE x with either WH_CBT (more probably) or WH_SHELL,
probably requiring a DLL. The class of the alert/confirm/prompt
(common dialog) windows are all "#32770" and alert has a single OK
button is a subwindow (class "Button"), while the other two each have
an OK and Cancel button, but the prompt window also has an Edit class
subwindow.

You might do a google search on: "32770" SetWindowsHookE x
Here's a useful page with some ideas:
http://groups-beta.google.com/group/...9d4612fdaec9f/

I'll look forward to seeing more on this topic,
Csaba Gabor from Vienna

Jul 25 '05 #10

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

Similar topics

3
5753
by: George Hester | last post by:
Nothing. The applet does what it is supposed to do but onload never fires. Any suggestions what may be the problem here? Thanks. -- George Hester __________________________________
2
3664
by: Boki | last post by:
Hi All, // code start alert("document.all.txtbox"+valueA+".value") // end code could you please advice, can it show the value of txtbox ?
13
38588
by: alvin.yk | last post by:
Hi, Normally, a piece of code such as <a href="http://www.yahoo.com" onclick="alert('hello');return false;">link</a> will stop the browser from actually going to href's destination. However, this is not the case with the IE7 I am using. What has changed?
1
1405
by: moho | last post by:
Hi, I've been struggling with AJAX for a while and notice that if I add the alert("xxx") in my code it always makes the code work. I'm using divs where I put the output from the server and then handling the info from there. Sometimes the JS doesn't find the newly inserted tags (divs with id), only when I add the alert command before it. It's kind of strange. Aswell as when enabling FireBug. So I guess that FireBug and the alert are doing...
9
5307
by: Tonio Tanzi | last post by:
I have an asp page with this tag <body onLoad="show_msg('<%=error_msg%>');"> where "show_msg" is a javascript function that shows the message contained in the asp variable "error_msg" only if this variable is not empty. The message is shown using the "alert()" function. The page works good in almost all the case, but some users have reported to my that the alert window don't appear.
24
8214
by: Jeremy J Starcher | last post by:
While reading c.l.j, I've noticed that some people prefer and indeed even recommend the use of "window.alert()" over "alert()". I can't find any technical reason to make this distinction, and seems to have a (tiny) amount overhead since window itself points to the global object, hence, a circular reference. (From everything I am reading, window is just a REFERENCE back to the global object, as opposed to a separate object.)
0
8610
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8873
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7740
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5862
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4623
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.