Help Loading .exe from a button that is a embedded resource

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts Page 1 of 1
Contributors
User avatar
holcombalex
New Member
New Member
Posts: 10
Joined: Thu Feb 25, 2010 7:28 am

Can someone please help me with this little issue I am having... Please PM me if you have an option that will work for me...

I have an ICON bar, and I have multiple programs that are .exe files that I want to be loaded in that icon bar when i release the software, So that is all fine, it saves the file settings to a file (that have been added to the icon bar already) ... Thats all good, the problem I came to was when I bought the Key Manager from CNS I ran into the issue that either I have 5 different usernames and activation keys for each of my software including the icon bar or I figure out a way to import the .exe files into the resources of the icon bar, and have the key manager only run on the icon bar,... Which is what I am thinking is the best option... So now I run into the problem of how to get those .exe files not to show in the built folder of the icon bar and not be required to even be their... So to get around this, I added each .exe file to the resources, I added a code that merely only hides the icon if you have show files and folder's disabled. So my next option is for a button that will load in the icon bar that when clicked, will open the .exe file from the resources folder, and all the .exe files are loaded in the resources folder, so therefor, no icon or other .exe file should/will show when I build the program and go into the release folder... so basically, Obviously having the .exe files that I want to load from the icon bar be Button's with the pictures of the icons is a better option anyway, incase they'd end up removing one of the icon's from the bar and not be able to put it back if it was just an icon that points to the .exe from the resources folder. That would force them to reload the software completely, So I think adding the button's that will launch the embedded resource is a better option... Please help me!!?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
"What I need here to load FILE.exe file from the references"

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
"The next .exe file" ( but i am thinking these 2 codes are going to be the same just point to different .exe's...)

~Thank you guys for your help. And CNS is definitely the best place for help!
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4392
Joined: Tue Aug 04, 2009 1:47 am

Hello,

Hmm all that sounded a bit complicated lol. Would I be correct in saying that youve added alod of *.exe files as resources and you want to be able to run those files from the resources?

Short answer is that you cant, atleast not that ive ever seen it done. In order to run an executable file it has to be on the users computer and cant be run from within another application.

You could do it by extracting the *.exe to the users computer and running it when the user presses a button and then delete it when the user closes it.

OR another way would be to add command lines to those *.exe files so that they would only run if they are started with a specific command. So you cold use your main application to launch them using the special command but if the user tries to use them without your main application they will not run. Here is information on using command lines: viewtopic.php?f=32&t=740&p=4214 I used this same thing for the Updatechecker included with CnS Desktop so that people cant run it by itself.

Hope that helps cooll;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
holcombalex
New Member
New Member
Posts: 10
Joined: Thu Feb 25, 2010 7:28 am

I actually got it to work... LOL, What I did was make it create a temporary directory and then it executes out of the resources and then deletes after it is closed... I would like to see it encode the extension of the file it makes (the temporary file so that it cannot be copied and pasted...) Now I need some help on making the software only work on a specific computer via maybe hard-drive id, or processor id scan or both... Would have been lovely to see something like that implemented in v4 of the Pro X V4 software, but hey, for 5.00, once the glitches are worked out I am sure it will work just fine 4 what its for. But the hardware ID information is going to need to be ran in a very similar way and would just make it tons easier if it were in the same process. Plus would be a GREAT automatic protection that I am sure the sales dept. wouldn't mind either ;) ... BTW, If you would like the code I would be more than happy to share it with you! :) (How to run your .exe that is embedded as a resource.)

Would love some help tho on the hardware ID side of this issue. Thank you CNS!
User avatar
holcombalex
New Member
New Member
Posts: 10
Joined: Thu Feb 25, 2010 7:28 am

WOW, Sorry, I am so busy, I didn't even read through your whole post n didn't realize what you had said. My bad... But ya, I guess I went with option 1., lol, nice one.

But ya the second Idea sounds like a really good idea as well! A quick thought, Can that function be called just like the first idea, (with a button or list function) thus giving you an encoded temporary file (being that it cant be executed from the temporary folder? In-case, it doesn't delete the folder or error's) and ultimately that delete or supposed to delete when u exit it? In Other Words... Combine option 1 with option 2.? And pre run all the .exe files through Themida before adding them as an embedded resource... Seems like a viable security option? No?
User avatar
MiztaInsane
VIP - Donator
VIP - Donator
Posts: 13
Joined: Thu Jan 14, 2010 3:39 pm

If I wanted to run something call CnS.exe from the resource folder I use this
Code: Select all
Dim SetupPath As String = Application.StartupPath & "\CnS.exe"

        Using sCreateEXEFile As New FileStream(SetupPath, FileMode.Create)
            sCreateEXEFile.Write(My.Resources.CnS, 0, My.Resources.CnS.Length)
        End Using

        Process.Start(SetupPath)
5 posts Page 1 of 1
Return to “Coding Help & Support”