Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Changing another apps title bar caption

Posted on 1998-09-04
4
Medium Priority
?
189 Views
Last Modified: 2010-04-30
I need to know how to change the caption of another application (i.e. telnet).
0
Comment
Question by:jjmartin
[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
  • 2
4 Comments
 
LVL 8

Expert Comment

by:Answers2000
ID: 1433046
API functions:
1. Get its hWnd using EnumWindows (you can find all top level windows) with this API
2. SetWindowText( hWnd, "Name" ) ;

The app may of course change it's title (effectively back) when-ever it chooses or may break if it depends on having the correct title text.  In most cases this will work.

Apps which paint their own custom text in the title bar may not change at all.
0
 
LVL 3

Author Comment

by:jjmartin
ID: 1433047
I have tried the SetWindowText and can't get it to work.  I am not sure what I am doing wrong.  It executes the SetWindowText, but nothing happens.  More points will be awarded for working code.
0
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 480 total points
ID: 1433048
Put this in a module:

Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long



Use this:

Dim H as long
H=FindWindow("TelnetWClass", vbNullString)
SetWindowText(H, "My Text")
0
 
LVL 3

Author Comment

by:jjmartin
ID: 1433049
Thanks for the help.  This worked perfectly.  I was missing the FindWindows function, when I tried it myself.
0

Featured Post

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.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

721 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