Starting a hidden C++ program

I am creating a C++ program with Visual Studio 2010 that is supposed to run on the background of my machine.

Therefore when I start it, I shouldn't see the CMD screen while it is running. How can I do this? Do I have to use the Win32 API or a normal C++ program will suffice?

Please note that my program has no GUI at all.

Answers


Use WinMain() :

#include <windows.h>

int WINAPI WinMain(HINSTANCE inst,HINSTANCE prev,LPSTR cmd,int show)
{
  // program starts here
  return 0;
}

// int main()  <-- remove main() 

Then ake sure your project settings are set so that you build a "Win32" program and not a "Console" program.

Edit: As @Sehe points out, winMain may not be necessary, although I am not quite sure where this option lies.


Need Your Help

Python: To avoid a TypeError do I need to check if there is a list in a dictionary, then check if that list holds the item?

python dictionary

I have several dictionaries. Sometimes they have with the key thing whose value is a dictionary.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.