Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. C++ and Visual Studio help? Error messages etc..

C++ and Visual Studio help? Error messages etc..

Scheduled Pinned Locked Moved C / C++ / MFC
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    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.

    D L L 3 Replies Last reply
    0
    • L Lost User

      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.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Your first link is bad. I would not use system() to spawn a console app. Use ShellExecute() or CreateProcess() instead where you have (some) control over the ensuing window. As far as WinMain() 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

      1 Reply Last reply
      0
      • L Lost User

        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.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • L Lost User

          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.

          L Offline
          L Offline
          leon de boer
          wrote on last edited by
          #4

          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

          L 1 Reply Last reply
          0
          • L leon de boer

            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

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            leon de boer wrote:

            Sometimes I just shake my head at answers offered

            I get much the same feeling with more and more of the questions posted here.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups