Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Destroying browser windows

Posted on 1999-01-08
26
Medium Priority
?
177 Views
Last Modified: 2010-05-03
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
Comment
Question by:timjc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 9
  • 6
  • +1
26 Comments
 
LVL 2

Expert Comment

by:cartti
ID: 1454911
Sounds like API calls to me. I'll go check it out.
0
 

Author Comment

by:timjc
ID: 1454912
Edited text of question
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1454913
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:timjc
ID: 1454914
Mirkwood,

What do you mean by class name ?
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1454915
Each window has a class name. This class name is important to find the window.
Take a look at the API FindWindow
0
 

Author Comment

by:timjc
ID: 1454916
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
 
LVL 6

Expert Comment

by:clifABB
ID: 1454917
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
 

Author Comment

by:timjc
ID: 1454918
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
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1454919
Do a sendmessage with WM_DESTROY or call DestroyWindow (API) with the hwnd as parameter.

0
 
LVL 6

Expert Comment

by:clifABB
ID: 1454920
Mirkwood is correct.  Or you could send a WM_CLOSE message.
0
 

Author Comment

by:timjc
ID: 1454921
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
 
LVL 6

Expert Comment

by:clifABB
ID: 1454922
Unfortunately, with VB, the answer is no.  Sorry.
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1454923
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
 
LVL 6

Expert Comment

by:clifABB
ID: 1454924
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
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1454925
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
 
LVL 6

Expert Comment

by:clifABB
ID: 1454926
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
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1454927
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
 

Author Comment

by:timjc
ID: 1454928
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
 
LVL 6

Expert Comment

by:clifABB
ID: 1454929
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
 

Author Comment

by:timjc
ID: 1454930
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
 
LVL 6

Expert Comment

by:clifABB
ID: 1454931
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
 

Author Comment

by:timjc
ID: 1454932
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
 

Author Comment

by:timjc
ID: 1454933
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
 
LVL 6

Expert Comment

by:clifABB
ID: 1454934
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
 
LVL 6

Accepted Solution

by:
clifABB earned 1000 total points
ID: 1454935
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
 

Author Comment

by:timjc
ID: 1454936
clifABB,

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

Cheers.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question