|
-
Sep 27th, 2008, 06:45 PM
#1
Thread Starter
Lively Member
[RESOLVED] Add Resource to File
What I need to do is add a resource to a exe file. For example, with programs like ResHacker you can do it. I was wondering if it can be done in VB6. If no one knows, then I will just have to use ResHacker via command line.
Thanks.
-
Sep 27th, 2008, 07:03 PM
#2
Re: Add Resource to File
VB6 has its own Resource Editor - go to Add-Ins menu, select Add-Ins Manger and make sure that "Resource Editor" is loaded and started.
One you did that you can go to Project menu and select "Add New Resource File".
When you compile your project resource file will be compiled directly into exe.
-
Sep 27th, 2008, 07:04 PM
#3
Thread Starter
Lively Member
Re: Add Resource to File
I know how to do that, what I need to do is add a resource file to an already compile file. For example, imagine you have a random exe file not made in visual basic. And I want to add a resource file to it. Thats what I need to do.
-
Sep 28th, 2008, 07:45 AM
#4
Re: Add Resource to File
 Originally Posted by The Rogue
I know how to do that, what I need to do is add a resource file to an already compile file.
No I don't think you can unless you recompile the exe.
 Originally Posted by The Rogue
For example, imagine you have a random exe file not made in visual basic. And I want to add a resource file to it. Thats what I need to do.
You can add any type of file to a Resource file and extract that file to where ever you want to when your app runs. If you wanted to add ResHacker to your exe then that isn't a problem. When you app runs you could extract ResHacker to your App.Path and Shell it from there. But don't forget, anything you add to a Resource file increases the compiled exe size by the same amount.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Sep 28th, 2008, 01:49 PM
#5
Re: Add Resource to File
You can use UpdateResource Function to do this, though its applications are fairly narrow.
Normally this is used to embed manifests, replace embedded Help text, update localization string tables, etc. It is rare for this to be useful though, and generally recompiling makes the most sense. If the program isn't already aware of the resource adding it doesn't accomplish much.
-
Sep 29th, 2008, 04:03 PM
#6
Thread Starter
Lively Member
Re: Add Resource to File
 Originally Posted by dilettante
You can use UpdateResource Function to do this, though its applications are fairly narrow.
Normally this is used to embed manifests, replace embedded Help text, update localization string tables, etc. It is rare for this to be useful though, and generally recompiling makes the most sense. If the program isn't already aware of the resource adding it doesn't accomplish much.
Thanks you, do you know how it works? I want to add a text file as the resource type "RCDATA" and the name "Settings". Would you know how to do that?
-
Sep 29th, 2008, 05:10 PM
#7
Thread Starter
Lively Member
Re: Add Resource to File
Here is my current code, this is just to test:
Code:
Dim FileHandle As Long
Dim ResData As String
ResData = "test data"
FileHandle = BeginUpdateResource("C:\Copy of test.exe", False)
Call UpdateResource(FileHandle, "RCDATA", "test", 0, VarPtr(ResData), Len(ResData))
Call EndUpdateResource(FileHandle, 0)
But, when I put in ResHacker, the resource data shows up as "ó••"
Anyone know why?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|