C++ and Visual Studio help? Error messages etc..
-
Anyone know why forms is doing this as soon as I started up, before I even started editing? https://linustechtips.com/main/uploads/monthly_2016_06/Untitled.png.df8fe73070d9ce8711aeefc1af8167a0.png Annddddd... Anyone know a way of disabling the console in the exe file, I went to properties and went to Subsytem and changed it to windows but that still doesn't do it. I was told to do WinMain() instead of main() but then I got 2 errors. I got the code off a website but the console is really bugging me. Here is my code and errors. https://linustechtips.com/main/uploads/monthly_2016_06/code.png.535c583f59f3461729fbc1e50280b773.png - Thank you.
-
Anyone know why forms is doing this as soon as I started up, before I even started editing? https://linustechtips.com/main/uploads/monthly_2016_06/Untitled.png.df8fe73070d9ce8711aeefc1af8167a0.png Annddddd... Anyone know a way of disabling the console in the exe file, I went to properties and went to Subsytem and changed it to windows but that still doesn't do it. I was told to do WinMain() instead of main() but then I got 2 errors. I got the code off a website but the console is really bugging me. Here is my code and errors. https://linustechtips.com/main/uploads/monthly_2016_06/code.png.535c583f59f3461729fbc1e50280b773.png - Thank you.
Your first link is bad. I would not use
system()
to spawn a console app. UseShellExecute()
orCreateProcess()
instead where you have (some) control over the ensuing window. As far asWinMain()
goes, see here."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
Anyone know why forms is doing this as soon as I started up, before I even started editing? https://linustechtips.com/main/uploads/monthly_2016_06/Untitled.png.df8fe73070d9ce8711aeefc1af8167a0.png Annddddd... Anyone know a way of disabling the console in the exe file, I went to properties and went to Subsytem and changed it to windows but that still doesn't do it. I was told to do WinMain() instead of main() but then I got 2 errors. I got the code off a website but the console is really bugging me. Here is my code and errors. https://linustechtips.com/main/uploads/monthly_2016_06/code.png.535c583f59f3461729fbc1e50280b773.png - Thank you.
It is impossible to guess what that code is supposed to be doing, or why it starts with a message box about a memory access error. Please edit your question and explain exactly what you are trying to achieve. If this is just code from the internet that you do not understand then it would be better to contact the author.
-
Anyone know why forms is doing this as soon as I started up, before I even started editing? https://linustechtips.com/main/uploads/monthly_2016_06/Untitled.png.df8fe73070d9ce8711aeefc1af8167a0.png Annddddd... Anyone know a way of disabling the console in the exe file, I went to properties and went to Subsytem and changed it to windows but that still doesn't do it. I was told to do WinMain() instead of main() but then I got 2 errors. I got the code off a website but the console is really bugging me. Here is my code and errors. https://linustechtips.com/main/uploads/monthly_2016_06/code.png.535c583f59f3461729fbc1e50280b773.png - Thank you.
Sometimes I just shake my head at answers offered ... anyhow moving on :-) Basically your definition of WinMain isn't correct it has parameters and a call directive, it will look like an overloaded function in that form
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){
I haven't done this in ages but you had a console app and are trying to turn it to a windows app so there will be a project setting somewhere. To be honest the fastest way to do this will be to set the project up from scratch. Delete all the files in your directory except the source files and stuff you made. Then goto "new project" and select your directory but make sure you select Win32 Application not Win32 Console Application. On the next screen click on the "application settings" and tick the box "empty project". Ok all that and you get an empty project. Now on the source files entry in solution explorer simply select "add existing item" and bring your source files in as you need. With the right WinMain you are then good to compile and all should be fixed. If that all gets too hard here is one I prepared earlier :-) Skeleton Windows App project setup[^]
In vino veritas
-
Sometimes I just shake my head at answers offered ... anyhow moving on :-) Basically your definition of WinMain isn't correct it has parameters and a call directive, it will look like an overloaded function in that form
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){
I haven't done this in ages but you had a console app and are trying to turn it to a windows app so there will be a project setting somewhere. To be honest the fastest way to do this will be to set the project up from scratch. Delete all the files in your directory except the source files and stuff you made. Then goto "new project" and select your directory but make sure you select Win32 Application not Win32 Console Application. On the next screen click on the "application settings" and tick the box "empty project". Ok all that and you get an empty project. Now on the source files entry in solution explorer simply select "add existing item" and bring your source files in as you need. With the right WinMain you are then good to compile and all should be fixed. If that all gets too hard here is one I prepared earlier :-) Skeleton Windows App project setup[^]
In vino veritas