Solved

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

Posted on 2009-04-06
25
555 Views
Last Modified: 2012-05-06
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.
0
Comment
Question by:ChiefoftheChiss
  • 10
  • 10
  • 5
25 Comments
 
LVL 5

Expert Comment

by:Mechanic_Kharkov
ID: 24082975
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
 
LVL 35

Expert Comment

by:torimar
ID: 24083041
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
 
LVL 6

Author Comment

by:ChiefoftheChiss
ID: 24084011
Thanks guys - checking out the links now torimar!
0
 
LVL 6

Author Comment

by:ChiefoftheChiss
ID: 24160754
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
 
LVL 35

Expert Comment

by:torimar
ID: 24161194
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
 
LVL 5

Expert Comment

by:Mechanic_Kharkov
ID: 24164608
"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
 
LVL 35

Expert Comment

by:torimar
ID: 24164680
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
 
LVL 6

Author Comment

by:ChiefoftheChiss
ID: 24165097
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
 
LVL 35

Expert Comment

by:torimar
ID: 24165367
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
 
LVL 5

Expert Comment

by:Mechanic_Kharkov
ID: 24165902
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
 
LVL 5

Expert Comment

by:Mechanic_Kharkov
ID: 24166817
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
 
LVL 6

Author Comment

by:ChiefoftheChiss
ID: 24168285
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 6

Author Comment

by:ChiefoftheChiss
ID: 24168354
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
 
LVL 5

Expert Comment

by:Mechanic_Kharkov
ID: 24169645
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
 
LVL 5

Expert Comment

by:Mechanic_Kharkov
ID: 24169854
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
 
LVL 5

Expert Comment

by:Mechanic_Kharkov
ID: 24169865
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
 
LVL 6

Author Comment

by:ChiefoftheChiss
ID: 24172469
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
 
LVL 5

Expert Comment

by:Mechanic_Kharkov
ID: 24172866
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
 
LVL 6

Author Comment

by:ChiefoftheChiss
ID: 24178040
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
 
LVL 5

Accepted Solution

by:
Mechanic_Kharkov earned 500 total points
ID: 24218638
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
 
LVL 6

Author Closing Comment

by:ChiefoftheChiss
ID: 31567307
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
 
LVL 6

Author Comment

by:ChiefoftheChiss
ID: 24218918
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
 
LVL 35

Expert Comment

by:torimar
ID: 24220200
Great solution, congrats!

And very pleasing to see it was achieved using Delphi which is my numer one favourite development tool under Windows ;)
0
 
LVL 6

Author Comment

by:ChiefoftheChiss
ID: 24220487
Thanks for your help too torimar, that resource editor will help with other projects in the future!
0
 
LVL 5

Expert Comment

by:Mechanic_Kharkov
ID: 24220556
[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

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In a hurry?.. scroll down to "HERE's HOW TO DO IT" Section. Greetings All, I was going to post this as question/solution, but its seems more appropriate as an article considering its length.  I felt it important to illucidate all the details c…
This is a little timesaver I have been using for setting up Microsoft Small Business Server (SBS) in the simplest possible way. It may not be appropriate for every customer. However, when you get a situation where the person who owns the server is i…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

707 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

14 Experts available now in Live!

Get 1:1 Help Now