views:

572

answers:

3

Iam creating an application like resource hacker. I want to change the title bar text of a window whose handle I can find out using SPY++.

Is there any way I can make modifications to the resources of the assembly and change the title by my code, so that the change is permanent.

Are there are tools free or commercial like my program? which can change the title bar text of a windows executable and assemble it back.

Iam open to suggestions.

Iam using VC++ to code my application.

+1  A: 

You are aiming for something impossible that could be achieved only in very few special cases. You can change the resources of an exectuable using APIs, eg. BeginUpdateResource, UpdateResource, etc. Only few applications store the windows/dialogs as a resource though, the windows are created at runtime and the text is hard-coded into the executable code or into string resources (or possibly something different, like in .NET or Borland VCL). Changing the executables permanently ranges somewhere between very hard to impossible, depending on the specific application.

Filip Navara
It looks like he's in control of the application, so it should be perfectly possible.
arul
As I read the question he wanted to change the title of window of arbitrary application based on window handle from Spy++. That is impossible.
Filip Navara
Clarification - I didn't say change the window handle from spy++. I have the windows handle which I can get using Spy++. I want to change the text using code. Is dissassembly an option?I can speak assembly language and I use ollydbg very often to debug third party tools.
Sumit Ghosh
If the text is hardcoded in the exe, how can I change it , I have heard there are tools which are able to change menu items text.. Any pointers..
Sumit Ghosh
If the text is not in resource (menu items often are in resources, but not always in the native format, eg. in .NET there's a whole new resource format) then the only choice is to modify program code, so yes, basically it is matter of disassembly and modifying the actual code. That is something that can hardly be described in 600 characters...
Filip Navara
I know it can't be described in 600 chars, but you can give me some pointers on where to start. it will be really appreciable..
Sumit Ghosh
A: 

See the MSDN's Resource overview page for more detailed information.

arul
+2  A: 

My browser currently has in its title bar "Change the Title Bar of a Windows Executable - Stack OVerflow - Opera". Please explain how that you could fix that via a resource.

Now, this is in fact possible, but not via a resource. You need to create a DLL that sets the caption, and intercepts any attempt to set it. Changing the caption is done by sending WM_SETTEXT to the HWND. Hence, your DLL will need to hook the WndProc for the main window class and discard WM_SETTEXT messages.

The next step is to add your DLL to the list of DLL dependencies of the EXE. You need to add your DLL to the IAT, but you don't need to import anything. The format is well described by Matt Pietrek in An In-Depth Look into the Win32 Portable Executable File Format

MSalters
thanks a lot, this worked like charm for me.
Sumit Ghosh