Solved

Changing another apps title bar caption

Posted on 1998-09-04
4
187 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 120 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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

724 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