Solved

Changing another apps title bar caption

Posted on 1998-09-04
4
185 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
  • 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

830 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