Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 182
  • Last Modified:

Destroying browser windows

Please can someone supply me with code that does the following:

a) Display a list of windows by title bar, open in a web browser (I use Netscape)

b) The ability to kill any window from that list.

If this can be done, it would help me rid those small annoying adverts and other other unwanted additional windows immediately that pop up when I enter certain sites. Currently I sometimes have to wait for the damn things to load before I can quit them!

Loadsa points coming your way if I'm supplied with comprehensive example from you.

Thanks,
Tim

P.S. I'm using VB 5.0 Enterprise
0
timjc
Asked:
timjc
  • 10
  • 9
  • 6
  • +1
1 Solution
 
carttiCommented:
Sounds like API calls to me. I'll go check it out.
0
 
timjcAuthor Commented:
Edited text of question
0
 
MirkwoodCommented:
Mail me after a couple of days when nobody has given a solution. I'll do it.
Meanwhile a task for you. I need to know what the class name is of the topwindow of Netscape. You can find that with a application like "spy".
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
timjcAuthor Commented:
Mirkwood,

What do you mean by class name ?
0
 
MirkwoodCommented:
Each window has a class name. This class name is important to find the window.
Take a look at the API FindWindow
0
 
timjcAuthor Commented:
I'm not 100% certain of all this, but I managed to download some code that returns the class name of every window. The class name changes slightly whenever I reboot Netscape. It may contain a memory address or something like that. The class name on one occasion for the solo Netscape window was Afx: 400000:b:100008:6:13d403ae

The code I used is on this page:http://www.mvps.org/vbnet/code/callback/enumwindows.htm
0
 
clifABBCommented:
If the class name doesn't work (I can't see how, but then it's Netscape), you could use the caption for the window instead.  The first word of the caption should be "Netscape", right?
0
 
timjcAuthor Commented:
clifABB,

That's a nice alternative you've suggested. I have the code that lists the window titles that go with the class names. I suppose I could do a filter on those windows with the word Netscape in the title. All I need to know is how you end its existence.
0
 
MirkwoodCommented:
Do a sendmessage with WM_DESTROY or call DestroyWindow (API) with the hwnd as parameter.

0
 
clifABBCommented:
Mirkwood is correct.  Or you could send a WM_CLOSE message.
0
 
timjcAuthor Commented:
Thanks you two. One last thing, is there an event or something similar that can be triggered when a new window has been created/ destroyed ? This would save me having to use a timer to give the user an updated list of Netscape windows should one pop up. I consider the timer a messy way of doing this.

Thanx again
0
 
clifABBCommented:
Unfortunately, with VB, the answer is no.  Sorry.
0
 
MirkwoodCommented:
clifABB is right. In VB this is not possible. I used to believe otherwise, but it is not possible to make a systemwide hook using VB.
0
 
clifABBCommented:
Actually, thinking about it, the subclass control in Spyworks from Desaware (www.desaware.com), just might allow a system hook.
I haven't used Spyworks in a few years, but you might want to look into it.
0
 
MirkwoodCommented:
No, NO, NOOO. Subclassing only works with the current process out the process you need a callback function that should be exported by a DLL. VB can't export functions, therefor VB cannot make a system wide hook.
0
 
clifABBCommented:
Mirkwood:
I'm sorry, I refered to Spyworks subclass control, I meant to refer to the subclass control, which does allow system wide hooks.  It's written in C++ so it doesn't have VB's limitations.  Please refer to the Desaware web site for explainations.
In a previous life, I created an application that "subclassed" another app.  Sort of an Add-in, before there were add-ins.  I used the callback control for this.
Unless Spyworks has changed dramatically in the last couple of years, it will accept a system hook.
0
 
MirkwoodCommented:
A couple of year ago. Maybe in win31?
BTW: an ocx is always embedded in either an exe or a dll. I can't expose exports on its own.
0
 
timjcAuthor Commented:
I've managed to write an application using your ideas. I've made it a bit more useful than just referring to Netscape windows. Would you like a look ? Please suggest a decent way of posting an exe to both of you.

I would like to share the points, but alas EE is limited in this respect. Any suggestions ?
0
 
clifABBCommented:
As far as sharing ponts, you can post a request in the customer service area asking Linda to do that.
Personally, though, I'm not in this just for the points, so if you want to just award Mirkwood the points, that's fine.
0
 
timjcAuthor Commented:
I'll take that as a polite 'no I don't won't to see it'. Never mind.

Someone post anything as an answer (bar cartti) and I'll get customer services to split the points.
0
 
clifABBCommented:
I'm sorry, I missed the your request to view your app.
You might be able to upload it to my ftp site (ftp.duck.org).  I would be happy to take a look and tell you what I think.
Log in to the site with 'anonymous' as the user name and your email as the password
0
 
timjcAuthor Commented:
cliffABB,

I have WS_FTP pro. I've tried logging on using your parameters. Unfortunatley, it comes back with the message Can't get "ftp.duck.org" host entry...

I can bring up the site in a browser, so I don't think it has to do with anything on your side. However, could you give me instructions on how to log on in WS_FTP ?

Did you mean I should use my own e-mail address as a password, rather than post you my e-mail address for a password ?

Tim
0
 
timjcAuthor Commented:
clifABB,

I have WS_FTP pro. I've tried logging on using your parameters. Unfortunatley, it comes back with the message Can't get "ftp.duck.org" host entry...

I can bring up the site in a browser, so I don't think it has to do with anything on your side. However, could you give me instructions on how to log on in WS_FTP ?

Did you mean I should use my own e-mail address as a password, rather than post you my e-mail address for a password ?

Tim
0
 
clifABBCommented:
With WS_FTP, there is an option button in the connect screen that will allow you to specify that the login type will be 'anonymous ftp'.  It will automatically use 'anonymous' as a login and your email as a password.  All other settings should just stay at whatever their default is.
0
 
clifABBCommented:
I read your post in the customer service area (I assume you were referring to this thread), so I'll post an answer to this question to get the ball rolling.

If I assumed wrong, you may reject this answer.

Thanks.
0
 
timjcAuthor Commented:
clifABB,

Just for the record, I did mention my intentions here.

Cheers.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 10
  • 9
  • 6
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now