Results 1 to 16 of 16

Thread: How to include EXE in VB6

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    340

    How to include EXE in VB6

    Hello everyone.

    How do i include a .exe file in my vb6 application.

    Possibly so that when I use the "shell" command in VB6, I can just write Shell (demo.exe) instead of using the whole path.

    In other words i want to compile my vb6 application with another .exe in it.

    Sorry if i'm putting it wrong.

  2. #2
    Frenzied Member some1uk03's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    1,663

    Re: How to include EXE in VB6

    Add it as a resource!..
    _____________________________________________________________________

    ----If this post has helped you. Please take time to Rate it.
    ----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.



  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: How to include EXE in VB6

    Which will trigger Trojan Horse recognition in many anti-malware packages.

    Just package and install applications correctly. Don't screw around like this.

  4. #4
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: How to include EXE in VB6

    Here's two examples

    1) RunEXEFromResource.zip

    Load Client.vbp into the IDE and run it

    This will extract the EXE from the resource file. It then saves it to your App.Path as "serverapp.exe" and then Shell's it.


    2) RunEXEFromResourceInMemory.zip

    Load Project1.vbp into the IDE and run it.

    This one extracts the EXE (Project2) from resource and loads it into main memory and runs it from there. No Shell used.
    Attached Files Attached Files


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  5. #5
    New Member
    Join Date
    Nov 2016
    Location
    Bali, Indonesia
    Posts
    14

    Re: How to include EXE in VB6

    Quote Originally Posted by jmsrickland View Post
    Here's two examples

    1) RunEXEFromResource.zip

    Load Client.vbp into the IDE and run it

    This will extract the EXE from the resource file. It then saves it to your App.Path as "serverapp.exe" and then Shell's it.


    2) RunEXEFromResourceInMemory.zip

    Load Project1.vbp into the IDE and run it.

    This one extracts the EXE (Project2) from resource and loads it into main memory and runs it from there. No Shell used.

    Hi i need the EXE executed with parameter in memory mode how to do that? for example: external.exe -o 'http://www.google.com' -u user -p pas

  6. #6
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: How to include EXE in VB6

    this have a red flag all over it,
    to have a need to hide a exe inside another exe and run different parameters is like you are trying to inject something into someone else computer.
    we create programs to be useful and also friendly, if your application is a collection of different tools, then you should just create a folder and put whatever inside of it, and from the main program you can call all of them using a shell command. be transparent about it and include a readme.txt where you tell exactly what everything is for when you distribute it.

  7. #7
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: How to include EXE in VB6

    Virus scanners look inside of ZIP files. However, I include a couple of EXE files inside of the resources of my primary application, and I've never had a virus scanner complain.

    And yes, including it in the resources is absolutely the way to get it done.

    I suspect my application is being scanned, and I suspect those executables in its resources are also being scanned, but there's no viruses in them, so it's all good.

    Good Luck,
    Elroy

    EDIT1: @baka: Why do we need to be "hiding" something to want to do this? (Resource viewers can easily see this stuff.) The two applications I include in my primary project are the portable open source SMPlayer and a freeware C3D viewer. Many (if not most) of my clients already have these things, but I need to send them specific videos or C3D files, so I like just unpacking them and feeding them the file I wish to open. I'm not sure I see any problem with this.

    EDIT2: Also, I'd hope that virus scanners would be smarter than this. Under this logic, all ZIP files and all wrapped-up installers could also throw up red flags. Don't they often have executables in them?
    Last edited by Elroy; Dec 3rd, 2017 at 11:27 AM.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  8. #8
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: How to include EXE in VB6

    VB6 gets used for malware so often now that you already start with many points against you by having a VB6 program. Anything like compiled code stuffed into resources just gets you that many more points. Add a few suspicious API calls and you can quickly reach the limit and get flagged.

    Installers and well-known self-extracting EXE formats get a pass because these are known formats with a legit purpose and easily explorable.

    Trying to hack around this by encoding binary as hex, Base64, etc. isn't working any more either. Anti-virus softwarte is onto these tricks now, and using them just gets you even more points on top of the points you get as a "dropper" in the first place.

    Just use a proper installer. There is no justification for using malware techniques in legitimate software. All it does is further tarnish VB6's reputation.

  9. #9
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: How to include EXE in VB6

    Yep a proper installer is the way to go, just add the exe to the setup cab and have it install in the same location as the main program.

  10. #10
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: How to include EXE in VB6

    Elroy, the importance here, is the credibility.
    im sure that this kind of programming is manly used to "hide" something, of course, it is possible to do like you say,
    instead of a installer you have the needed drivers/tools within the program itself and install if needed, its portable and smart.

    if we are transparent about it and people knows you and trust you, why not?
    but we also have those random tools around the net that people creates, without credibility, would you trust it?

  11. #11
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: How to include EXE in VB6

    Dilettante, that logic just doesn't make sense. Does that say we shouldn't have the occasional drink because many people drink and drive, and kill people while doing so?

    If I want to use a legitimate/legal program (i.e., VB6), and develop a legitimate/legal application; and, as part of that application, I want to include within it, a couple of legitimate/legal "helper" application, I don't see how any blame for viruses falls to me.

    Also, as I've said in several places on these forums, my application runs in the most restrictive of environments (medical), and I've never once had anybody report that their virus scanner flagged my application. And it's initial release had both of those applications (SMPlayer and C3D Viewer) within its resources.

    All The Best,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  12. #12
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: How to include EXE in VB6

    I'm kinda with baka on this one.

    Malicious or not, seems like a waste of time. I cannot see what one can gain from this that wouldn't already be available by simply including the extra EXEs as separate files you shell out too when you need them.

    Even if the purpose was to hide it for malicious purposes, what is the point of hiding it inside another EXE? You still need the user to execute outer EXE so if they don't trust it, they'd never run it and then it wouldn't matter how many EXEs you have inside it because they will never be extracted.

    Creating an ad-hoc installer is about the only sensible reason I could think of for something like this. If this is the case, then create a self-extractor and include that EXE as a resource as others have suggested. That way, you could include other files and even entire directory structures.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  13. #13
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: How to include EXE in VB6

    Quote Originally Posted by Niya View Post
    Even if the purpose was to hide it for malicious purposes, what is the point of hiding it inside another EXE? You still need the user to execute outer EXE so if they don't trust it, they'd never run it and then it wouldn't matter how many EXEs you have inside it because they will never be extracted.
    That makes the point of why this shouldn't be a big deal. That, and virus scanners truly should be smart enough to scan resource entries.

    Quote Originally Posted by Niya View Post
    I cannot see what one can gain from this that wouldn't already be available by simply including the extra EXEs as separate files you shell out too when you need them.
    For me, I like to distribute a single portable executable, even though a bit of its functionality is incorporated into a couple of other portable programs. It's just a matter of convenience and simplicity (as much of what we do is). If we're not about convenience and simplicity, tell them all to throw out their computers and go back to typewriters and slide-rules.

    Best Regards,
    Elroy

    EDIT1: But hey. If y'all don't want to do it, then, by all means don't.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  14. #14
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: How to include EXE in VB6

    Well, I am a firm believer in not adding stuff into the exe that does not need to be in there. If you have two exes then go with two exes never cram one into the other. If you really want to distribute a single file then it is very possible to create a proper installer as a single exe file, have it install all files that are needed and auto run the main program when done.

    Basically if I see a program that has lots of stuff in it that it tries to drop at runtime I am going to be likely to delete it right away and steer clear of who ever created it as IMO that is a shoddy way to do it

  15. #15
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: How to include EXE in VB6

    theres no right or wrong.

    me, i really hate installers, because its not always easy to remove it, even running the uninstaller its not always that everything gets removed.
    installers like to put stuff everywhere and rewrite the registry. and installer is not equal to safe. installer can have tons of malware and crap, and install servicea without even asking you.

    i love programs that I put in any folder I wish and if I delete that folder, the program is completely removed, no trace except the trash bin.

    a couple of times i tried examples project from here that I couldn't run, why? because I don't have the needed drivers to run it.
    nowhere to read how and what to install. this because they have something installed on their own computer. and for me to run it i need to install that to. for me this is a bad project, why share something that I can't run? no matter if its a splendid program or not, for me its a waste of time.

    that is why i always create programs without dll/ocx dependency (except the absolutely needed runtimes)
    and of course if my program use something external, like a dll, that will be included in the package. that is why I love portable.

    so, some would say that portable is bad, but some would say that installers are bad. my point, no right or wrong.

    conclusion, a portable, if done well and with good intentions is way better then a installer. at least for me.

  16. #16
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: How to include EXE in VB6

    Quote Originally Posted by baka View Post
    i love programs that I put in any folder I wish and if I delete that folder
    Quote Originally Posted by baka View Post
    that is why i always create programs without dll/ocx dependency ... and of course if my program use something external, like a dll, that will be included in the package
    You just described my primary application. It creates up to 10 sub-folders and drops many files, but there all within the main folder where you've placed the main executable. I've even got a "dependencies" folder with every single dependency in it, including ActiveX OCX and DLL files. Not one single thing needs to be registered.

    If you want to just try it, go for it. When you're done, delete a single folder and you're done with it.

    I'd have it no other way.

    Best Regards,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width