I have recently made a small program in C++ which prompts the user for yes or no and then if its a yes, the program will shutdown the computer. I made it because I hate the way you have to turn off windows 8.
I made this program in MS visual ultimate 2012 and I tried to search on the internet about how to release a C++ program but I could find anything.
I am a beginner so I'm still learning C++. Basically I want to make a program that will install my program on a computer running windows, so its doesn't have to be complicated. I've just found where I saved my project and copied the 'Debug' folder and pasted it in program files on the C drive and got the application file that starts the program and out it on the desktop? Is that right? - I know this isn't really installing it but it does work.
Remember I am using MS visual ultimate 2012.
Another problem is I am using the code: system("shutdown -s -t 1"); and I have read that this system() is evil and really bad to use as it causes big security holes; is there any other way that I can tell the computer to shutdown or is that code ok?
If you want me to post my C++ source code of the program if you need it, just ask.
Yeah I came across the function ExitWindowsEx but it was going on about inputting values and other parameters, I didn't understand it so I didn't use it.
But you've got the ExitWindowsEx( EWX_SHUTDOWN | EWX_FORCEIFHUNG ); as a beginner I probably should tackle this now but like I said before I tried to use and that was the website I found, I do want to use it but just could not get it to work with all the _In_ and values you have to do.
You want to compile your program. You also do not need to write an installer. Intallers generally set up registry values, create the folder directies for the program, etc... but you're writing somthing small that doesn't need to create any files and such (i assume). Even if it did need to create files it isn't necessary to write an installer.
You can just copy/paste the binary anywhere to use it.
When ever you compile a program in C++ it creates an .exe file.
To get this file to run you need to include all the .dll files it is dependent on.
When compiling pay attention to what files are used. My compiler says something like "symbols loaded" next to a .dll file name.
Make a copy of these .dll files and include them in the same folder as your .exe file. Then you are good to go.
Now if you want to install... you should move the .dll files into the system directory. On my computer it is called system32. If the .dll files are in this folder then your .exe file will also work.
One easy way to move the .dll files into the system folder is with simple batch comands. I like to create an install.bat file for this. Then an end user just clicks on that file and it is done.
I once played around with something called NSIS installer. It is free but complicated and not always working right.
Thanks for the information Manga, I will take a look at that NSIS installer.
But as my program is very small I will probably look into that batch installer.
You could also make the shutdown program the same way. You can actually hide the shutdown bat command in image files and stuff too not that you would need to.
Oh right interesting.
Might have a go at it.
Wow, still got a lot to learn though ;)
I made the shutdown program with a nice power button from icon archive; search it on Google if you have never heard of it.
Probably have but oh well.