title: C++ (VC2010) Help converting console app to hidden Windows app?
body: <p>I've read more than a dozen pages explaining how to convert a Win32 console application into a Windows application that will run without briefly opening and closing a console window, but I'm too much of a beginner to get it to work. </p>
  
  <p>For example, in VC2010 I made the two changes in the project properties described here:</p>
  
  <p><a href="https://stackoverflow.com/questions/3884124/convert-a-console-app-to-a-windows-app">convert a console app to a windows app</a></p>
  
  <p>and changed Main to WinMain but of course got error messages from the compiler.</p>
  
  <p>Following other pages, I also tried creating a console application, then, in the Win32 Application Wizard, and changing the Application Type to a Windows application, but I can't figure out what to do next. I've tried changing int Main to int CALLBACK WinMain, but of course that doesn't work either. </p>
  
  <p>Is there anyone who can help a beginner with this? Here is what I think is the relevant part of my code EDIT: the complete code, for anyone who wonders what this is for, is here: </p>
  
  <p><a href="https://www.dropbox.com/s/1h8x1k2zv0lc5d1/vPasteCPlus.txt?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/1h8x1k2zv0lc5d1/vPasteCPlus.txt?dl=0</a></p>
  
  <pre><code>#include &lt;stdafx.h&gt;
  #include &lt;windows.h&gt;
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;codecvt&gt; // for wstring_convert
  #include &lt;locale&gt;  // for codecvt_byname
  using namespace std;
  
  // helper to get path to this application
  string ExePath() {
  char buffer[MAX_PATH];
  GetModuleFileNameA( NULL, buffer, MAX_PATH );
  string::size_type pos = string( buffer ).find_last_of( "\\/" );
  return string( buffer ).substr( 0, pos);
  }
  
  int main(int argc, char* argv[])
  {
      // get the command-line argument if any, and do various things
  } 
  </code></pre>
  
  <p>Again, apologies for this beginner question. The only experience I have with C++ is writing console applications, and any advice will be gratefully received.</p>