Using VB, can I control the Title Bar contents of other programs?

Need to be able to control the TITLE BAR contents of other APPS.
Can I do it somehow with VB?
Any other suggestions?
rbendAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimCotteeHead of Software ServicesCommented:
You need to use the api function SetWindowText in order to be able to change the title bar contents.
0
VbmasterCommented:
I uploaded a 'Window Handling' Class to

http://www.cyd.liu.se/~freqv416/clsWindow.cls

Check it out, you can try to change the 'Caption' property to see the SetWindowText API in action.
0
rbendAuthor Commented:
VBMaster: please don't think I'm an idiot, just not that accomplished at VB programing.
1) I'm not aware of how to use a class.
   Can you walk me through it a little?
2) Will this change the Window Title of any apps window or just that of a VB app/?
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

jjmartinCommented:
Try this:

Here are your public declarations:
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long


Here is the code.  This will launch a telnet session and change the caption in the title bar:

Private Sub Command1_Click()
    Dim lHandle As Long
    Dim H As Long

   
    Shell "telnet.exe"

    H = FindWindow("TelnetWClass", vbNullString)
    lHandle = SetWindowText(H, "JUNK")

End Sub

You should know that this method is not 100%.  The caption has the tendancy to change back to what it was before you changed it.
0
rbendAuthor Commented:
tried to substitute Notepad for Telnet but could not get it to work.
How would you do that?
0
jjmartinCommented:
If you do not know the WindowsClassName then you can use the orginal text in the title bar.  Substitute this:

H = FindWindow(vbNullString, "Untitled - Notepad")


This is passing a null string in place of the windows class name, and instead telling the find window API to look for a window with the title "Untitled - Notpad".
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rbendAuthor Commented:
This seems ok.
The one I really needed to change was Microsoft Outlook Express and I tried several combinations of things but could not get it to work.
Thanks..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.