Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

I Need Help {VBScript Stop Popups In IE}

Greetings. I am hoping someone can help me craft a simple VB script as a sub-function I need, which can help stop IE pop-ups before they appear so there is no flicker? Can this be done? I am building a app which will have this feature. What I mean by Flicker is the brief appearance of the offending IE pop-up briefly before it is removed. Some pop-up blockers achieve their result by stopping pop-ups before they appear and some after they appear, which I hope to do something about in my situation Thank you! Happy Holidays & New year! -AngieX

Edit by Shurik:
Welcome. Please, in the future to give more meaningful titles to your threads, not just "I need help". Thanks.

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Stop Popups From My Browser Control?
How do I stop popups from my browser control? I have thought about killing all instances of IE that come up that are not mine, but am wondering if there is another way.

Stop Command In VBScript
For Windows 2000, the Stop command for Debugging VBScript no longer works. Does anyone one know a work around?

Can I Pass A Parameter To VBSCript And How Can I Get Current Path In VBScript?
Can I pass a parameter to VBSCript ?
How can I get the local path in VBScript?

No Popups
Quote:Originally Posted by Aspen2KIf your talking about the webbrowser control, NewWindow2 event, set Cancel = True

you seems to be 'brain' here

i have a problem me n my team just made a project of a secured browser but the point is when u find a popup n try to make it small or close its activate the task bar ..

this is popup code ..
Option Explicit

Dim WantedX As Long
Dim WantedY As Long
Dim WantexW As Long
Dim WantedH As Long
Dim Canceled As Boolean
Dim WantedURL As String

Private Sub set_browsersize()
On Error Resume Next

If WantexW = 0 Or WantedH = 0 Then
If PopUpNeedToClose = False Then
If PopupMode <> 1 Then WBrws1.Navigate WantedURL 'FrmBrowser.WBrws1(NbLoadedWeb).Navigate WantedURL '
FrmBrowser.BoutonNew(9).Enabled = True ' insert by leo
End If
PopUpNeedToClose = True

If PopupMode = 1 Then
' Pas de popup
Canceled = True
PopUpNeedToClose = True
Me.Move WantedX, WantedY
WBrws1.Top = 0
WBrws1.Left = 0
WBrws1.Width = WantexW
WBrws1.Height = WantedH
PopUpNeedToClose = False
End If
End If
End Sub

Private Sub Form_Deactivate()
On Error Resume Next

Unload Me
End Sub

Private Sub Form_Load()
On Error Resume Next

WBrws1.Silent = True
WBrws1.FullScreen = True
WBrws1.TheaterMode = True
WantedURL = ""
End Sub

Private Sub WBrws1_BeforeNavigate2(ByVal pDisp As Object, Url As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
On Error Resume Next

If Url = "http:///" Or Url = "" Or NavigationAllowed = False Then
Cancel = True
Exit Sub
End If
WantedURL = Url
If PopUpNeedToClose = True Then Cancel = True
End Sub

Private Sub WBrws1_NewWindow2(ppDisp As Object, Cancel As Boolean)
On Error Resume Next

Dim F2 As New FrmPopUp
Set F2 = New FrmPopUp
Set ppDisp = F2.WBrws1.object
End Sub

Private Sub WBrws1_WindowClosing(ByVal IsChildWindow As Boolean, Cancel As Boolean)
On Error Resume Next

Cancel = True
Unload Me
End Sub

Private Sub WBrws1_WindowSetHeight(ByVal Height As Long)
On Error Resume Next

WantedH = Height
Me.Height = (Height) * Screen.TwipsPerPixelY
End Sub

Private Sub WBrws1_WindowSetLeft(ByVal Left As Long)
On Error Resume Next

WantedX = Left
End Sub

Private Sub WBrws1_WindowSetResizable(ByVal Resizable As Boolean)
On Error Resume Next

Resizable = False
End Sub

Private Sub WBrws1_WindowSetTop(ByVal Top As Long)
On Error Resume Next

WantedY = Top
End Sub

Private Sub WBrws1_WindowSetWidth(ByVal Width As Long)
On Error Resume Next

WantexW = Width
Me.Width = (Width) * Screen.TwipsPerPixelX
End Sub

any answer on block task bar ?

Now here is some thing ive been thinking about

If a application calls a popup let sat for example

Kazaa I want to be able to stop kazaa from calling
A popup but allow other programs to and allow me to run
ie so how would I go about stopping certain applications from
Being able to call popups

any help would be helpful

My application is trying to intercept the right mouse click, so I can pop up a form filled with certain 'properties' of the object the user clicks on. The problem I am having is that the windows 'Edit' box (the one with cut, paste ....) pops up before my form and I can't seem to figure out how to turn it off. The user has to right click 'twice' to get to my form.

Any Ideas?

PopUps From VB In IE
Can VB open popup windows like javascript in IE?

Also, is there anyway to control the browser window in IE using VB, such as removing the addressbar or altering the window so it becomes changes to fullscreen mode?

Interacting With IE Popups From VBA
I'm trying to create a macro from VBA within Excel to automatically go to a particular website and download a certain file. I have done this, however each time it runs, the website gives me a popup box that I have to click "Yes" in order to continue. Is there a way for my code to click "Yes" automatically for me?

Making Popups
Hi all

Finally back to the work after a very very loooooooooong break.
Now the thing is I wantto make a pop up kind of a small form. Apart from my main form of my application i need to do the following things:

1. It has to be a bit like mesenger so should ecide in the system tray.
2. Every time there is a new message it should slide up a small popup kind of note that shows that there is a new message (same as in yahoo messenger when someone goes online or offline or some new mail arrives).

Putting the icon to system tray can be done and there are a lot of similar queries o the forum.
But could some one please solve my second poblem. Although suggestions for both the problems are highl appreciated.

Thaks in advance
Ashutosh Vyas

VB Web Browser Popups!
Does anyone know how to close a popup window using visual basic.

I can get the address of the popup i.e.(
but I cant close them.

IE Popups In A Non Browser
I need some desperate help here. Im writing an application that I use while Im online. But it is NOT a browser. The application (Im writing) needs to stop IE popup windows from popping up. But since it isnt a browser Im clueless on how to get popups to stop. It was easy when I doodled around with writing a browser. But again, since its not a browser Im writing I dont know how to get the popups to stop.

My application simply runs in the background when Im browsing with IE. But like I said, I want it to be able to stop poppups also.

Thanks for ANY type of help or code examples on this.

Help! Tired Of App Popups!
my application is a client.. and when it loads a page.. i get so much ads on the page and pop ups that come onmy screeen.. how can i get a pop up blocker or something? for my app

Popups With POINTAPI
I'm trying to generate a popup at the mouse point in the system tray (custom). The popup is not VB generated, so its not a "normal" popup, ie, this one has a picturebox at the bottom. The popup works fine as long as the main window is normal/maximized, but if minimized, the POINTAPI returns the popup at location (0,0), so it pops up at the top left corner instead! If I restore the window, then everything works fine again. Any ideas on making it pop up at the right spot if the window is minimized?

Closing All Popups
Hi guys, I would to know how to "close" all the popup windows that was clicked from a main/parent page. I have 2 variables declared, but I want the code to do when the user clicks X on the main parent page, the popup windows should be gone too, how can I accomplish that?

Private WithEvents oIEApp As SHDocVw.InternetExplorer
Private oPopup As SHDocVw.InternetExplorer

Closing Popups
I could not figure this out. I have an IE 1 open, then clicked on help link, the 2nd IE screen/window open. But when I close my first IE, I want the second IE/popup to be closed too. How can VB achieve this?

Autocompletion And 'popups'

For my script-writer program (from the syntax highlighting thread) I want to use autocompletion and 'popups'...

With autocompletion I mean something like in VB, I think it's called intellisense or something...
When you type "Text1." you get a list with possible options.
But, I want it to appear when you type like... 4 characters of one word.
For example, a command is "game_manager". If you type "gam" i want a combobox sort of thing to popup saying "game_manager".

With 'popups' I mean the tips you get in VB for example when you use a function.
For example, if you type "Instr( " you will get a yellow popup that says what parameters you can set here.

Does anyone know any example codes that I can use for this?
I don't even want to try coding this myself as I'm still only a noob, but it would be a VERY cool feature to my program, and I will ofcourse give all credit to the original author...

I hope you can help me with this!

WebBrowser Popups!
Hello friends

Im using the WebBrowser control in my browser...but one thing that really disturbs me is when a popup appears, and the internet explorer icon is in the title bar!

Is there any way to create my own popup screens?

Blocking Popups
sometimes there are sites that has popup within the webbrowser control. is there a way to block those popups?

Disable Popups In Ie
when i make a browser, why do the popups always appear in internet explorer? can i stop this? And, how can i launch another site in internet explorer?

Disable Popups
ANyone know how to disable popup's on a Web Browser contorl in VB?

Webbrowsers And Popups.....
I think you need some code for the NewWindow2 Event. Try this link and see if it helps you.

In the webbrowser control's newwindow2 event, if I set cancel to true, will it close the window that opens?

Webbrowser Popups Again *omg*
humpf.. i was searching for code that would make the popups open in new windows (create new forms). I know it's something in the NewWindow/NewWindow2 event for the webbrowser control.

tried searching here but the function was disabled

thanks, i need the code

thanks again

and again

WebBrowser && Popups
how do i prevent mybwebbrowser control from being flooded with popups (i don't want to see any of them), has to work when leaving sites also (which has a nasty javascript which opens another window)..


Stopping IE5.5 Popups
Can any1 help me with the following: i would like to stop IE5.5 from showing those anying popups, by using Visual Basic 6.0

Close Popups
Hi I'm writing a browser in vb that closes popup windows before they come up

it works great except if a popup is closed, the program doesn't quit when it's supposed to

this is the popup code:

I'm using unload frmHome to quit

Private Sub WebBrowser_NewWindow2(ppDisp As Object, Cancel As Boolean)
On Error Resume Next
Dim NewWindow As New frmHome
NewWindow.WebBrowser.RegisterAsBrowser = True
Set ppDisp = NewWindow.WebBrowser.Object
If GetSetting("Wizard", "Options", "Popup") <> 1 Then NewWindow.Show Else lblMessages.Caption = "Popup disabled on " & Now
End Sub

More On Those Annoying Popups
Hi folks,
This code was lovingly ganked from this very board, thanks to all who have posted it.
I'm attempting to use this snippet as a popup-window killer, for now I'm testing with notepad, calc, and eudora.
Two small queries:
I'm having trouble passing the string to "sApp" from my ini file. The string comes through fine as "puk" and it displays in "label1". Assigning it with "sApp = puk" doesn't work and I don't know exactly why (probably something quite simple). I'm hoping someone can help with this.
For the moment I'm using a timer so I can see what each cycle is doing but in the end it'll likely have a for/next or a do/loop as I haven't messed with do/loops much yet. I'm wondering which method, a for/next or do/loop, a pro would use and why?
Any help is appreciated.



Public Const WM_CLOSE = &H10
Public Const MAX_PATH = 260

Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
ByVal lParam As Long) As Long
Declare Function EnumWindows Lib "user32" _
(ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
(ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long

Private sAppTitle As String
Public glHwnd As Long

Public Function fEnumWindowsCallBack(ByVal hwnd As Long, ByVal lpData As Long) As Long
Dim lResult As Long
Dim sWndName As String

fEnumWindowsCallBack = 1
sWndName = Space$(MAX_PATH)

lResult = GetWindowText(hwnd, sWndName, MAX_PATH)
sWndName = Left$(sWndName, lResult)
'Search Title for our string
If (InStr(1, sWndName, sAppTitle, vbTextCompare) > 0) Then
Debug.Print sWndName
glHwnd = hwnd
fEnumWindowsCallBack = 0
End If
End Function

Public Function SearchWindows(sApp As String, hwnd As Long) As Long
sAppTitle = sApp
glHwnd = 0
Call EnumWindows(AddressOf fEnumWindowsCallBack, hwnd)
SearchWindows = glHwnd
End Function

CODE------form with a couple of labels and a timer.

Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal _
lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long

Private Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal _
lpFileName As String) As Long

Dim Pukn As Integer
Dim sApp As String
Dim pukt As Integer
Dim puk As String * 128
Private Sub Timer1_Timer()
Pukn = Pukn + 1
pukt = GetPrivateProfileInt("PUKD", "Total", 3, "kia.ini")
If Pukn = (pukt + 1) Then Pukn = 0
lntc = GetPrivateProfileString("PUKD", Pukn, "blahblah", puk, Len(puk), "kia.ini")
Label1 = puk'labels are temporary
Label2 = Pukn

sApp = "note"'<----- needs to pass the name from the ini "puk"
'sApp = puk'dunno why this fails

glHwnd = SearchWindows(sApp, Me.hwnd)
If glHwnd > 0 Then
PostMessage glHwnd, WM_CLOSE, 0&, 0&
End If
End Sub

'timer interval is set to 2000
'c:windowskia.ini consists of:

Open Popups
What can i say ... i know vb lol but theres a problem that i really dont understand ..
i projected a web broswer securised under vb , but i have problem with popups that aint open or open and u cant see form to close'em from button .. dunno , its possible that page thats running in my broswer with javascript code to do not allow those ? or i need a code that solve this

Login Popups
I'm using the internet control to scan through a list of Url's which is working fine but when I come across a secure Url that requires a login and you get the standard login-popup is there a way to close this window as it stops my routine in it's tracks.

Any ideas?

Menu Popups
Is it possible to make a menu popup scroll (or seperate into several popups) when the length of the menu popup exceeds the length of the form.

WORD DOC SaveAs Without Popups ?

Is there any property in the SaveAs method of word.doc that disable any popups ?

The SaveAs done automatically by my application and any pop will stuck it.

Is there any way to block any message ?


Stopping IE MsgBox Popups
How do you stop websites from popping up an IE MsgBox? These sites are usually related to phishing schemes and viral sites. I'm trying to make a web browser and some sites are giving me issues.

Code For Answering To Popups

when I want to answer to a popup saying if I want to save changes to the file closing and say no I use this code


Now I get another popup telling me:

There is a large amount of information on the Clipboard. Do you want to be able to paste this information into another program later?

I want to answer no.

What code do I need to use?

Thank you

WORD DOC SaveAs Without Popups ?

Is there any property in the SaveAs method of word.doc that disable any popups ?

The SaveAs done automatically by my application and any pop will stuck it.

Is there any way to block any message ?


DDE Query/ VB Error Popups
Problem number 2 for the day

Im using DDE with VB6, RSLinx to talk to an allen bradley PLC.

Just trying to create some error handling methods for if the DDE link gets dropped for whatever reason.

When doing a write from a textbox I do it the following way:

Public Function WriteInteger(data As String, address As String)

'write data using a 'hidden' text box

FrmMain.Text1.Text = data

FrmMain.Text1.LinkTopic = "RSLinx|BOARD_GRADER"
'Define DDE application and Topic

FrmMain.Text1.LinkItem = address
'Define DDE link item

FrmMain.Text1.LinkMode = 2
'Open DDE link (manual)

'Write data to RSLinx

FrmMain.Text1.LinkMode = 0
'Close DDE link

End Function

This all works very well. If the DDE link is lost and the function tries to perform the LinkPoke operation it of course fails. VB then pops up with an error dialog which says:

Run time error 286

Timeout while waiting for DDE response


I want to do my own error handling here, how do i stop VB popping up with this error message and let my own 'on error goto...' code do the work..

Admin please delete this post. just got the thing working dunno why i wouldnt when i first tried

Message In Baloon Popups

I have written a chat program wherein the client PC successfuly connects with the server PC and the messages can be exchanged.

I was wondering if we can make few changes in the chat program. say

1) When a user logs on to the client PC, a 'silent message(say the IP address)' is sent to the server and a connection is established.

2) when the user in the server PC send a message to the client PC then the message should display on the client PC in shape of a baloon pop up. (as in Microsoft Outlook, when a new msg arrives...)

How do I achieve this?

Popups On A Modal Form
Just a note in case anyone searching has the same problem I did.....

I have found that in generating a new modal form from a popup, when I go to do another popup on the just created form, the popup doesn't work.

I can understand why, if the original popup has not been dropped then this may be masking the new popup, even though it is on another form.

The getaround I have used is to fire a one shot timer with the first popup, and add the new modal form call in the timer procedure.

The popups then work on the new modal form.

Menu Editor Popups
when i click on the popup, how can i make it display a tick next to it?

like an on/off switch.. but how do i code it?

How Can I Close Or Kill Popups In IE Using VB
This is my first time to write in this forum, I was looking for codes to do my project. I think VB can do that that's why I'm in in VB after long time. In my project I want to be able to close pop-ups windows in IE. Can someone give me codes or hint.


Popups Popping Up Slow !!
I am having a vb6.0 application which has 25 odd forms.
and i am using sql 7.0 database .

When I click on 1 form the next form opens up and does
some function.It has been observed that when 12-15 users
or more log into that application and they click the respective forms the next form pops up pretty slow. The solution which
we r trying out is truncating the log file from database.
We r having a seperating server for the database

Is there some possible solution for this ?

Mirc Popups Editor
does anyone know how to create a Popups editor for mirc
please help

Closing PopUps From WebBrowser
Everyonce in a very blue moon my weather program that I made gets a pop up. It checks the same site everytime and its very rare that I get a pop up but sometimes when it goes to and then gets the source code I get a pop up. Is there anyway of killing this stupid thing?

Closing Popups Don&#039;t Work
hi I'm using this code to close popups in my vb browser:

Private Sub WebBrowser_NewWindow2(ppDisp As Object, Cancel As Boolean)
On Error Resume Next
Dim NewWindow As New frmHome
NewWindow.WebBrowser.RegisterAsBrowser = True
Set ppDisp = NewWindow.WebBrowser.Object
If GetSetting("Wizard", "Options", "Popup") <> 1 Then
End If
End Sub

but the problem is, when I close the frmHome form AFTER I open a popup, it doesn't really exit the program, just doesn't show frmHome. I think this is because of the "set ppDisp = NewWindows.WebBrowser.Object" line. Does anyone know what's wrong?


Disabling Popups For WebBrowser!
I have a browser on my form and I don't want it to show any popup windows! One of the methods that I've tried before trigger javascript errors because of disabling the popup option!

Annoying Browser Popups

I was wondering if there is a way to kill those browser ad popups.. (geocities etc.) either by allowing only one browser window to be open, or by killing the extra ad windows from a list. I have been trying to write a little program to do this as my first VB project but it is a bit beyond me at the moment. I know there are a couple programs out there that do this but this is a learning experience for me (I hope). All help is appreciated.


Tray Menu Popups
Okay when i see some programs in the system tray i see the if you right click on them once the popup menu appears and if you right click on them twice then the menu dissapears, does anyone know how to code this as it has been bugging me for weeks. When ever i try to do this the menu opens again not disapears, any help would be great

Challenge: Multiple Popups...
Anybody got any ideas on this one.

As you know you can't have more than one context menu - created with PopupMenu - displayed at a given time.

i.e. if you have a form displayed which has a context menu, and one of the items on the menu brings up another form as modal. If the second form has as popup, any call to PopupMenu is ignored.

So, how can do you create multiple popups in a given App space?

I've played around all sorts of ways methods including using TrackpopupMenu and subclassing to get the WM_ menu messages, all of fail for one reason or another (mostly timing issues).

Anyone ever tries this?

WebBrowser Control Popups
I've been Googling all day, but to no avail.

I have a webpage I'd like my webbrowser to go to, but it has a popup. I'd like to find the url of the popup, and possibly disable popups entirely. Can anyone just point me in the direction of an article or example that would help me in the slightest way? VB6 is what I'm using btw.

Copyright 2005-08, All rights reserved