I wrote a c++ program and I want to execute my second program inside it, which is a exe file. The problem is I want to share my program to others as one single file.
When I search on the internet, I found this solution.
Just store the second .exe file as a binary resource inside the main .exe using an .rc file at compile-time. At run-time, you can access it using
FindResource()
,LoadResource()
, andLockResource()
, and then write it out to a temp file on disk before passing it tosystem()
.
But I don't understand how to "store the .exe file as a binary resource"
I am currently using CreateProcess()
to start my second program which working greatly.
Can anyone write some example for me?