Search code examples
c++visual-studio-2010socketsmfcserversocket

Make Non-GUI server application in Visual Studio


I did a project of Server Socket in Visual studio in C++ MFC based. Now, after debugging the project, server GUI opens, then after clicking on the CONNECT button on server GUI, you can connect the clients to that server and so on.

Now I want to use that server exe file in some other computer. So that whenever that computer starts, that server exe automatically starts. so for this i need to disable the connect button, so that after debugging, server GUi opens and connected automatically. But i don't want that server GUI opens in another computer in autostart as well. i want to disable that server GUI.

I got an idea of modalless dialog to work on it. Is it good or what approach should I use ?


Solution

  • The only professional and stable solution of such an application is, to splitt it in a console part, which you put under the control of service control and a gui part wich the user can start when he wants.

    I tried solutions like yours and so I can tell you from my own experience, that you will face a lot of problems.

    However, a possible solution would be to hide the window and lay the app down to systray and this is a very interesting discussion about hinding windows.

    Additionaly I have two good advices in case of MFC:

    1. Never ever just "copy-past" code without to know what MFC is doing in the background (Win32api).
    2. Do not use MFC. Have a closer look at QT or wxWidges when you need windows, to shortcut encapsulation of win32api also have a look at boost library. It is realy worth the time you spend on!

    Good luck!