Is it possible to change the program name of an application that shows title bar while it's running?

I would like a program so it's name shows differently in the title bar as well as the taskbar. When I right click on it the details the product name appears to be what is displayed here but it's locked down.
LVL 6
ChiefoftheChissAsked:
Who is Participating?
 
Mechanic_KharkovConnect With a Mentor Commented:
Works! :-) Then just change looked class name in the starter, and try to start WoW.bin with new one.

This one executes WoW.bin, and looks for GxWindowClassD3d window class.

File ExeTitleChanger.zip (25 KB) uploaded
Your Download-Link #1:http://rapidshare.de/files/46871439/ExeTitleChanger.zip.html
0
 
Mechanic_KharkovCommented:
The button on the task bar shows the name of the application window.  And the title bar of the main application form (if there is any) shows title of this form. Both can be controlled by application in runtime (app can change both titles separately when it needs). So, if You want to change one of this titles, You will need some resource editing software (easy way), or if the application changes these titles in runtime, then You will need to find this hardcoded strings in program body, and change them. This operation is not always possible without recompiling program and need some experiense to be implemented.
P.S. Info that You see in properties dialog also is stored in exe's resources and are not depend on two titles mentioned above. This info can be also changed with resource editing software.
0
 
torimarCommented:
A good free resource editor is this one:
http://www.wilsonc.demon.co.uk/d10resourceeditor.htm
(It does not support Vista, so you will have to run it in compatibility mode, but I can't say whether this will work for a task so close to the system as this one)

A pretty promising looking commercial tool (which offers a trial) is this one:
http://www.restuner.com
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
ChiefoftheChissAuthor Commented:
Thanks guys - checking out the links now torimar!
0
 
ChiefoftheChissAuthor Commented:
Neither of the programs is able to modify the running program name. Any other suggestions?

They both were able to modify the details of the program, unfortunately that doesn't change the name in the title.

Other ideas?
0
 
torimarCommented:
It works, I just tested it.
I used the XN Resource Editor (first link) under Windows XP.

The trick is to look under the "Dialog" subtree and to find the main form of the application (the one that looks like the bare programme window, with no controls, but with the title displaying), then to change the "Caption" value in the panel left of the form ('General' tab).

I included a screenshot for your convenience - the mouse cursor points to the caption.

If your application consists of several forms, you will have to change all of them.
Clipboard01.png
0
 
Mechanic_KharkovCommented:
"It works, I just tested it."

It can work for one application, but not for another.   :-(
Look, if I create main form (stored in resources) with no caption or some fake one, and then assign it's caption in runtime

Delphi sample:

Application.MainForm.Caption := 'BlaBlaBla v.' + VersionString;
Application.Title := Application.MainForm.Caption;

//Then, after some actions (e.g. file open), I do next thing:

Application.MainForm.Caption := '[' +OpenedFileName + '] ' + Application.Title;

...

Where would You change these titles with resource editing? ;-)


0
 
torimarCommented:
In the case you just described we'd have to try a hex-editor, and we wouldn't be free to change the application name into anything we like, that is true.

There is also a chance though that the asker in his test was looking through the String resources, not the Dialog captions.
0
 
ChiefoftheChissAuthor Commented:
Just to give you a better idea of what my friends and I are working on doing, we are doing a Total Conversion of World of Warcraft (see below if this scares you off)
We are good with modeling and scripting and SQL and server side.. but we are stuck on trying to change the EXE to have our happy little name in the running window.

Would you like me to attach the EXE? when I bring it up in XN Resource Editor it doesn't have a dialog box area like your screen shot shows.

I'm afraid I don't know anything abou the Delphi stuff that Mechanic_Kharkov posted.

Your time is VERY appreciated.


(From what we've been able to see it's fine with Blizzard)
http://www.blizzard.com/us/legalfaq.html
Can I do a total conversion of your games?

Yes. We've seen some very polished and fun conversions for our games, and have no problems with total conversions so long as they are for personal use and do not infringe our End User License Agreement included in our games, nor the rights of any other parties including copyrights, trademarks or other rights.

0
 
torimarCommented:
It's fine with Blizzard as long as it's in accordance with their EULA.

If you check the WoW EULA here: http://www.worldofwarcraft.com/legal/eula.html
under points 2.A and 2.E you will see that they prohibit "modification" and "reverse engineering" of the game client, which is the exe file.

So far, you changed/converted parts of the data files. But the exe, so I read this, is taboo.
0
 
Mechanic_KharkovCommented:
Oops.. :-/
"E.      modify or cause to be modified any files that are a part of the Game Client in any way not expressly authorized by Blizzard; "

I think, I know exactly what to do :-)
They prohibit to change content of their files. But there is no rule for running process in the memory! ;-)
I'd propose to compose a little launcher, that will run main client exe, then change it's captions, icons, or any desired appearance item. And this launcher can stay working while main client is running, even changing title with scheduled intervals (if software refreshes it).
If it sounds like a solution, let me know. Such launcher is easy to write.
0
 
Mechanic_KharkovCommented:
I've created a simple sample of such launcher. Originally it's intended to launch file Notepad.bin (that is renamed windows notepad.exe). (Renaming will prevent users to launch the child application instead of our launcher). In addition, the launcher can modify some data that will prevent child app from start up.

So, how to test:
copy windows notepad exe to this exe folder, and rename it to notepad.bin;
Run ExeTitleChanger1.exe and You'll see the notepad with changed caption.

In notepad You can open any text file - this changes title of it's window (run time change, as I have mentioned above). While launcher is active, it refreshes window title each 500 ms, so caption will be repaired.

Source included in attach. Even if You have no Delphi to compile it, You can use resource editor to change the caption, and the child executable name. This strings stored in the exe's resources:

resourcestring  ExeFileName = 'notepad.bin';  CaptionToSet = 'Super Text Editor by MCH Software ;-)';
And no EULA is affected! :-) (but renaming is modification too)..
Good luck!

Attach:
File ExeTitleChanger.zip (24 KB)
Your Download-Link #1:http://rapidshare.de/files/46776117/ExeTitleChanger.zip.html
0
 
ChiefoftheChissAuthor Commented:
I'll get right on that exe file changer you sent.

And thanks for copying me on the EULA... looks like we'll have to drop our plans for world (of warcraft) domination, guess we only googled as far as that part that I saw and didn't think to read through the EULA. Either way I'm definately going to follow through with what we've done here for the sake of EE and it doesn't look like making a launcher that changes the title window violates the EULA.

Thanks!
0
 
ChiefoftheChissAuthor Commented:
That and I really want to see if it's possible.

Okay so I copied in my notepad.exe file and renamed it to notepad.bin (which i like your logic of renaming it) when I click ExeTitleChanger1 it DOES launch notepad, but it still reads as 'untitled'. I figured I could just drag your cool thing into other directories and rename the exe to notepad.bin, so I put it in the WoW folder and renamed WoW.exe to notepad.bin and it launches the program but the name stays up there.

Your idea sounds exactely like what my question was, am I doing something wrong?
0
 
Mechanic_KharkovCommented:
If Your notepad is located exactly in the same folder that ExeTitleChanger1.exe, then everything must go fine. For notepad at least. :-/
Something going wrong and I can't ques what exactly.
If we'll try to put some debug info to executing process, it would clarify something.
I'll try to show some diagnostic messages from the launcher.
0
 
Mechanic_KharkovCommented:
Try this new version of launcher. It shows error messages in console window.

File ExeTitleChanger1.exe (42 KB) uploaded!
Your Download-Link #1:http://rapidshare.de/files/46780776/ExeTitleChanger1.exe.html

After that show this window messages, and we'll know what is going wrong.
0
 
Mechanic_KharkovCommented:
it's source to clarify with error messages:

{
**********************************************************
Simple child-process launcher with caption change feature.
(C) Mechanic. Kharkov XLIV A.S.
**********************************************************
}
{$APPTYPE Console}
 
program ExeTitleChanger1;
 
uses
  SysUtils, Windows;
 
resourcestring
  ExeFileName = 'notepad.bin';
  CaptionToSet = 'Super Text Editor by MCH Software ;-)';
 
const
        //delay in milliseconds to refresh caption
        UpdateDelay = 1000;
 
var     Wnd: HWND;
				sProcessInfo: PROCESS_INFORMATION;
				sStartupInfo: STARTUPINFO;
				szCommandLine: PChar;
				dw: DWORD;
 
 
//thread's windows enumeration callback
function EnumProc(aWnd: HWND; LParam: LParam): boolean; stdcall;
var Name : array [0..MAX_PATH] of char; s: string;
begin
  //some checks of window (e.g. its class name, or flags)
  if True then //check conditions stub
  begin
    GetWindowText(aWnd, Name, SizeOf(Name));
    s := StrPas(Name);
    GetClassName(aWnd, Name, SizeOf(Name));
    writeln('- class: '+StrPas(Name)+'; text: '+s);
    Result := true; //true - iterate again; false - break
    Wnd := aWnd;
  end;
end;
 
begin
  //find an run the file
  if not FileExists(ExeFileName) then
  begin
    writeln('file not found');
    writeln;
    write('Finished. Press Enter');
    readln;
    Exit;
  end;
  ZeroMemory(@sStartupInfo,sizeof(STARTUPINFO));
  ZeroMemory(@sProcessInfo,sizeof(PROCESS_INFORMATION));
  sStartupInfo.cb := sizeof( STARTUPINFO);
  szCommandLine := PChar(ExeFileName);
 
  if not CreateProcess(nil, szCommandLine, nil, nil, false, CREATE_NO_WINDOW or
    NORMAL_PRIORITY_CLASS, 0, 0, sStartupInfo, sProcessInfo) then
    begin
      writeln('Create process failed: '+SysErrorMessage(GetLastError));
      write('Finished. Press Enter');
      readln;
      Exit;
    end;
try
  //wait for its main window
  dw := WaitForInputIdle(sProcessInfo.hProcess, 10000);
  if dw <> 0 then
  begin
    writeln('WaitForInputIdle timeout .'+SysErrorMessage(GetLastError));
    Exit; //timeout or error
  end;
 
  //find main window
  Wnd := 0;
  EnumThreadWindows(sProcessInfo.dwThreadId, @EnumProc, 0);
  if Wnd = 0 then
  begin
    writeln('No window is found');
    Exit; //not found
  end;
 
  //Change title in loop with delay until child app is stopped
 
  while True do
  begin
    //check visibility of a window
    if IsWindowVisible(Wnd) then
    begin
      //set new caption
      if not SetWindowText(Wnd,PChar(CaptionToSet)) then
      begin
        writeln('SetWindowText failed. '+SysErrorMessage(GetLastError));
        Exit;
      end;
    end;
    //wait for exe termination
    if WaitForSingleObject(sProcessInfo.hProcess, UpdateDelay) <> WAIT_TIMEOUT then
      Break;
    write('.');
  end;
 
finally
  //close handles
  CloseHandle(sProcessInfo.hProcess);
  CloseHandle(sProcessInfo.hThread);
  writeln;
  write('Finished. Press Enter');
  readln;
end;
 
end.

Open in new window

0
 
ChiefoftheChissAuthor Commented:
Thanks again for the work you've done on this, I attached the output of the text file.

The dots come up when notepad is open.
"Finished. Press Enter"  appears when I close notepad
- class: Notepad; text: Untitled - Notepad
- class: MSCTFIME UI; text: MSCTFIME UI
- class: IME; text: Default IME
..............................................................
Finished. Press Enter

Open in new window

0
 
Mechanic_KharkovCommented:
it's clear that all 3 windows of notepad are passed to enumerating procedure. So the last code uses wrong window to set caption.

Try this new version that checks class name.
In addition I've shipped this archive with my notepad that works in my case (see attached picture).

File ExeTitleChanger.zip (61 KB) uploaded
Your Download-Link #1:http://rapidshare.de/files/46786699/ExeTitleChanger.zip.html


Screenshot.GIF
0
 
ChiefoftheChissAuthor Commented:
hooray - so good news your notepad.bin works now, and so does mine. 2.jpg is an example of mine working now.

1.jpg is sadly what happens with the WoW.exe still though.
1.jpg
2.jpg
0
 
ChiefoftheChissAuthor Commented:
Thank you so much - This will be fun to play with! Your dedication and skills on this has been superb! That file works wonderful now.
0
 
ChiefoftheChissAuthor Commented:
could i make one more request is it possible to change the "debugging window" to not display the -class entries? or just the first one?

Thanks again!
0
 
torimarCommented:
Great solution, congrats!

And very pleasing to see it was achieved using Delphi which is my numer one favourite development tool under Windows ;)
0
 
ChiefoftheChissAuthor Commented:
Thanks for your help too torimar, that resource editor will help with other projects in the future!
0
 
Mechanic_KharkovCommented:
[q]could i make one more request is it possible to change the "debugging window" to not display the -class entries? or just the first one?[/q]
Of course we can hide all windows related to launcher at all! :-)  I have modified source to make launcher exe not the console application. If You wish to return the console back, just uncomment directive {$DEFINE Debug}.

File ExeTitleChanger.zip (23 KB) uploaded
Your Download-Link #1:http://rapidshare.de/files/46873990/ExeTitleChanger.zip.html
(source also is in archive)

[q]And very pleasing to see it was achieved using Delphi which is my numer one favourite development tool under Windows ;)[/q]

There is no difference in which lang we use the Windows API. :-) And Pascal is my favorite too.

Below is the final source code:

{
**********************************************************
Simple child-process launcher with caption change feature.
(C) Mechanic. Kharkov XLIV A.S.
**********************************************************
}
//{$DEFINE Debug}
 
{$IFDEF Debug}
{$APPTYPE Console}
{$ENDIF}
 
program ExeTitleChanger1;
 
uses
  SysUtils, Windows;
 
resourcestring
  ExeFileName = 'WoW.bin';
  WndClassToSearch = 'GxWindowClassD3d';
  CaptionToSet = 'Super WoW caption by MCH Software ;-)';
 
const
        //delay in milliseconds to refresh caption
        UpdateDelay = 200;
 
var     Wnd: HWND;
				sProcessInfo: PROCESS_INFORMATION;
				sStartupInfo: STARTUPINFO;
				szCommandLine: PChar;
				dw: DWORD;
 
 
//thread's windows enumeration callback
function EnumProc(aWnd: HWND; LParam: LParam): boolean; stdcall;
var Name,Name1 : array [0..MAX_PATH] of char; s: string;
begin
    Result := true; //true - iterate again; false - break
  {$IFDEF Debug}
    GetWindowText(aWnd, Name, SizeOf(Name));
    AnsiToOEM(Pchar(@Name),PChar(@Name1));
    s := StrPas(Name1);
    GetClassName(aWnd, Name, SizeOf(Name));
    AnsiToOEM(Pchar(@Name),PChar(@Name1));
    writeln('- class: '+StrPas(Name1)+'; text: '+s);
  {$ELSE}
    GetClassName(aWnd, Name1, SizeOf(Name1));
  {$ENDIF}
    if StrPas(Name1) = WndClassToSearch then
    begin
      Wnd := aWnd;
  {$IFDEF Debug}
      writeln('        ^^ This window selected');
  {$ELSE}
      Result := false; //stop search
  {$ENDIF}
    end;
end;
 
begin
  //find an run the file
  if not FileExists(ExeFileName) then
  begin
  {$IFDEF Debug}
    writeln('file '+ExeFileName+' not found');
    writeln;
    write('Finished. Press Enter');
    readln;
  {$ENDIF}
    Exit;
  end;
  ZeroMemory(@sStartupInfo,sizeof(STARTUPINFO));
  ZeroMemory(@sProcessInfo,sizeof(PROCESS_INFORMATION));
  sStartupInfo.cb := sizeof( STARTUPINFO);
  szCommandLine := PChar(ExeFileName);
 
  if not CreateProcess(nil, szCommandLine, nil, nil, false, CREATE_NO_WINDOW or
    NORMAL_PRIORITY_CLASS, 0, 0, sStartupInfo, sProcessInfo) then
    begin
  {$IFDEF Debug}
      writeln('Create process failed: '+SysErrorMessage(GetLastError));
      write('Finished. Press Enter');
      readln;
  {$ENDIF}
      Exit;
    end;
try
  //wait for its main window
  dw := WaitForInputIdle(sProcessInfo.hProcess, 10000);
  if dw <> 0 then
  begin
  {$IFDEF Debug}
    writeln('WaitForInputIdle timeout .'+SysErrorMessage(GetLastError));
  {$ENDIF}
    Exit; //timeout or error
  end;
 
  //find main window
  Wnd := 0;
  EnumThreadWindows(sProcessInfo.dwThreadId, @EnumProc, 0);
  if Wnd = 0 then
  begin
  {$IFDEF Debug}
    writeln('No window is found');
  {$ENDIF}
    Exit; //not found
  end;
 
  //Change title in loop with delay until child app is stopped
 
  while True do
  begin
    //check visibility of a window
    if IsWindowVisible(Wnd) then
    begin
      //set new caption
      if not SetWindowText(Wnd,PChar(CaptionToSet)) then
      begin
  {$IFDEF Debug}
        writeln('SetWindowText failed. '+SysErrorMessage(GetLastError));
  {$ENDIF}
        Exit;
      end;
    end;
    //wait for exe termination
    if WaitForSingleObject(sProcessInfo.hProcess, UpdateDelay) <> WAIT_TIMEOUT then
      Break;
  {$IFDEF Debug}
    write('.');
  {$ENDIF}
  end;
 
finally
  //close handles
  CloseHandle(sProcessInfo.hProcess);
  CloseHandle(sProcessInfo.hThread);
{$IFDEF Debug}
  writeln;
  write('Finished. Press Enter');
  readln;
{$ENDIF}
end;
 
end.

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.