views:

79

answers:

4

iI there any way to add a GUI component to an application which is already running?

I.E. Add an extra tab into a third party GUI?

I have a third party application where I need to add an extra tab into the tabbed interface (or even a button to link to a new form).

I can see the UI components in UISpy and Spy++ but Can't see a way to alter or add them...

Any ideas? Maybe altering the memory?

Update:
The application I have created to wrap around the third party app is .NET but the third party app is written in VB6

+1  A: 

I suppose it's entirely possible with reflection, with the aid of Reflector, assuming it's not been obfuscated. Explore around the reflected source until you find the class of the form, and the instance of the form that you want to modify, then you can invoke the Controls.Add method, or anything else you need to, with reflection. But unless you know exactly what you're doing, you could run into some unexpected behavior from the application.

nasufara
A: 

I assume it's a .NET WinForm app. If you do not have the source files and the app isn't too big, you can try 'decompiling' it and add in your code to become a new app.

I'm a great fan of Lutz Roeder's Reflector which generate code from the CLR codebase. Here's a link to his tools. http://www.lutzroeder.com/dotnet/

Update:

darkassassin93 is right, hopefully the app is not obfuscated :)

o.k.w
The application I have created to wrap around the third party app is .NET but the third party app is written in VB6, so the compiler wouldn't work too well but I will have a look for interests sake :)
JD
@JD: I see, I've updated your question with your comment and also added `VB6` tag.
o.k.w
+1  A: 

You can use ResHacker.

http://www.angusj.com/resourcehacker/

Basically, each GUI form is saved as a resource inside of a particular Windows executable. ResHacker has a built-in GUI editor for editing "Dialogs" (as they are referred to in ResHacker).

I have opened up the exe file (and a few dll files in the same dir) and no DIALOG tree in res hacker. Can a dialog be held in another file (e.g. dll) in VB6?
JD
Yes, resources can be saved in DLL files too. If I were you, I'd search all the DLL/EXE/OCX files in the directory looking for the dialog.
VB6 does not use resource for dialogs so this will not work in his case
wqw
A: 

You should have strong reason for doing that.

I think you can start with Add Tab using pure WinAPI and TabCtrl_InsertItem Macro

If you have HWND of TabControl you can try to add your own tab. with TabCtrl_InsertItem. Although i don't think it's possible to do that from another process. But you should try.

Trickster
I will try this - I have started the process using my wrapper program so have the window handle, and I can find the hwnd of the tab control easily. Will report back.
JD
This might cause problems in the code of the third party app. For instance they might handle the tab-click event or read the property for the number of tabs (reasonably enough assuming that only *their* tabs would be present). Personally I very strongly advise you not to use this approach.
MarkJ