Is there any way to hook into an old VB6 program using C# and modify some of its UI? Also, maybe even modify some of its features? I wouldn't know the first thing about doing this but I know you can do stuff like this by injecting DLL's into programs. I just need to do it in C#.
-
1Do you have the source code to the original program? Do you have Visual Studio 6.0? Otherwise, it sounds like you're making a lot of unnecessary work for yourself. – Bob Kaufman Jan 25 '12 at 23:37
-
1Hmmm, @LordZardeck provides new definition for masochism. Be quicker to rewrite the thing wouldn't it? – Tony Hopkinson Jan 25 '12 at 23:45
-
I do not have the source to it. Other wise I would just modify the code. The original developer has decided to abandon the project, but has refused to give up the code. – LordZardeck Jan 25 '12 at 23:46
-
@TonyHopkinson as complex as this program is, i'd rather not try re-writing the whole thing. – LordZardeck Jan 25 '12 at 23:48
-
Agree with @Tony. Use this as an opportunity for a fresh start. Rewrite the application. If what you say about the original developer is true, there will most certainly be bugs and requirements ahead that cannot be solved by whatever patching/dll scheme you're envisioning. – Bob Kaufman Jan 25 '12 at 23:49
-
Visual Basic 6 would emit some executables in it's own bytecode, and others in native code. If you've got the bytecode EXE you should have good success with a reverse engineering tool. If it's a native EXE, not so lucky. See http://www.vb-decompiler.org/ and Google for other decompilers. – ta.speot.is Jan 26 '12 at 00:54
-
2Keeney is on a hobbyhorse promoting RealBASIC, he makes money off the victims he convinces to use it. I would tend to *completely* ignore him. Besides, that blog post is horribly outdated. Win8 fully supports running VB6 programs. – Bob77 Jan 26 '12 at 08:53
-
1@The Nail That blog post is *six months old* and written by someone with an axe to grind. If you *must* link to something about VB6 and Win 8 on *every* VB6 question, please keep it in the family and link to [the StackOverflow question](http://stackoverflow.com/questions/4221661/vb6-running-on-windows-8). I've edited the VB6 tag wiki to link to it (it may still be pending review before it appears) – MarkJ Jan 26 '12 at 13:33
-
Who cares about the code, probably not too clever if it's in VB6 anyway.
Reverse engineer with inject on a trivial app isn't worth the effort, and on a non-trivial could easily be more effort than just starting fresh anyway. First thing to do is look at the deliverables and see if you can "see" the current resources. – Tony Hopkinson Jan 26 '12 at 18:13 -
@MarkJ Not sure what you mean with *must* and *every* because this was the first comment I ever made on VB6/Win 8. But I see your point, and removed my comment. – The Nail Jan 26 '12 at 20:52
-
Maybe you could tell us *why* you need to do this and someone may have an alternative approach. The method you suggest is not recommended and is just papering over the cracks. – Matt Wilko Jan 27 '12 at 09:20
-
@Matt I'm trying to do multiple of things, like modify some of the forms and add some others. The bare minimum i'd like to do is modify some of the default form values. – LordZardeck Jan 27 '12 at 17:30
2 Answers
You can't really inject DLLs into programs unless they were designed to do that, for instance with a plugin architecture.
That said you can slightly mess with the UI of the application by using some specific Windows API calls. For instance, many, many years ago, I used this method to change the look of Excel.
Check out the link - it includes the source code and some images of the affected changes.

- 59,598
- 102
- 325
- 594
-
2It IS possible. I've seen it done with people hacking games to cheat. – LordZardeck Jan 25 '12 at 23:58
-
Someone should have told Microsoft: http://research.microsoft.com/en-us/projects/detours/ – ta.speot.is Jan 26 '12 at 00:53
-
@LordZardeck I think you speak of games like Minecraft and others where the source was available or the interface exposed by a certain DLL was known or well understood. I've patched Minecraft before but that is because the source is available. – AngryHacker Jan 26 '12 at 01:03
-
-
I'm going to accept this answer as I have accepted defeat in trying to do what I wanted. – LordZardeck Feb 01 '12 at 19:42
If you don't have the source code I'd say things are rather difficult. You might look at this book: Gray Hat Python Programming for Hackers and Reverse Engineers.
I would suggest Python, because of the plethora of good open source projects and material on the subject. It won't be as easy as just writing C# and having it elegantly mesh into VB code. Good Luck.

- 6,637
- 4
- 45
- 60
-
??? There's a plethora of material on C# and certainly an adequate quantity of open source projects (not sure how they are relevant) – MarkJ Jan 26 '12 at 13:37
-
I was referring to things like Immunity Debugger. There are similar tools in .NET like VB Decompiler, but they are not free apps. And there is a plethora of information on reverse engineering in Python. There are a ton of books on C#. I know of few that go into reverse engineering. It's an artform unto itself, and the tools and techniques are better established in Python than C#. – David Rinck Jan 26 '12 at 16:51