Solved

Changing another apps title bar caption

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now