Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Changing another apps title bar caption

Posted on 1998-09-04
4
Medium Priority
?
190 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 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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 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…
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…
Suggested Courses

885 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