|
-
Apr 12th, 2006, 10:44 AM
#1
Thread Starter
Member
[RESOLVED] How do i prevent the pop up message box in IE?
Hai you guys. Can you guy help me with this? I'm trying to block the internet connection of computers remotely for my Computer Lab system. I have manage to make the system goes offline but everytime the user try to access the internet using IE, it will pop up the message "Web page unavailable while offline" and whether to connect or stay offline. So my question here is how do i prevent this pop up message from showing using VB 6.0 or prevent the user from clicking " Connect " because once they click "connect" they will be able to connect to the internet. Very urgent coz i only have 2 more days to finish this project.
Please help ... Thanks alot.
-
Apr 12th, 2006, 10:57 AM
#2
Re: How do i prevent the pop up message box in IE?
There is no need to start a second thread: http://www.vbforums.com/showthread.php?t=397941
Anyway, the easiest way is probably to use a timer with interval set to 1:
VB Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_CLOSE = &H10
Private Sub Timer1_Timer()
Dim lhWnd As Long
lhWnd = FindWindow("#32770", "Web page unavailable while offline")
If lhWnd Then SendMessage lhWnd, WM_CLOSE, 0&, 0&
End Sub
However that is very much re-active rather than preventative. You'd probably have to do some subclassing to prevent the dialog box ever coming up at all.
-
Apr 12th, 2006, 11:10 AM
#3
Re: How do i prevent the pop up message box in IE?
I've thought about the FindWindow thing. But I was looking for some better way to prevent it. But google didn't help me here. 
Another thing you may want to use,
Programmetically set IE to online mode.
Note: This will not work on active instances of IE. You'll need to close all IE windows before this.
-
Apr 12th, 2006, 11:40 AM
#4
Thread Starter
Member
Re: How do i prevent the pop up message box in IE?
To bushmobile
Thanks for your reply. But i can't seems to get the code to work coz i'm still getting that dialog box. Can you please help me? I have set the timer interval to 1000
Thanks alot.
-
Apr 12th, 2006, 11:41 AM
#5
Re: How do i prevent the pop up message box in IE?
Try setting the interval to 1
-
Apr 12th, 2006, 12:04 PM
#6
Thread Starter
Member
Re: How do i prevent the pop up message box in IE?
Nope still can't work i have tried to set the interval to 1, 5 and also 1000. But it still can't work. Anyone have any idea why?
Thanks alot.
-
Apr 12th, 2006, 12:10 PM
#7
Re: How do i prevent the pop up message box in IE?
Hmm, have you enabled the timer? is the code actually firing?
Perhaps check that FindWindow is returning a value.
-
Apr 12th, 2006, 12:48 PM
#8
Thread Starter
Member
Re: How do i prevent the pop up message box in IE?
To bushmobile
You are the best thanks alot. The code works the problem was just that i have disable the timer after i have enable it. The dialog box is not popping up anymore. Thanks alot.
But can you explain to me how does the code accually function?
Thanks a billion.
-
Apr 12th, 2006, 12:52 PM
#9
Re: [RESOLVED] How do i prevent the pop up message box in IE?
The dialog is still popping up, that code is just closing it really quickly.
The FindWindow API returns the hWnd of the window that has the classname and caption that we request, if it doesn't find that window then it returns 0.
If the window has been found, we just send a WM_CLOSE message to it which makes it close.
-
Apr 12th, 2006, 01:02 PM
#10
Thread Starter
Member
Re: [RESOLVED] How do i prevent the pop up message box in IE?
Thanks alot for your explaination. I have been asking around and searching in the net but no one can tell me the solution. Thank again.
Have a nice day...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|