[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Adding Windows Sockets support to existing MFC application?

Posted on 2005-04-27
3
Medium Priority
?
761 Views
Last Modified: 2013-11-20
Hi experts

For the purpose of adding support of Windows Sockets we check the <Windows Sockets> checkbox in the MFC App wizard step4 of 6.

I have created an MFC SDI application & has completed 80% coding. Currently my application does not supports Windows Sockets as i did not checked the <Windows Sockets> checkbox in the MFC App wizard step4 of 6.

Is it possible to add Windows Sockets support in my MFC SDI application at this stage or wud i need to create a new project with windows sockets support & cut code from old project & paste in new project.

Waiting for suggestions

Regards  
0
Comment
Question by:stellarguy
  • 3
3 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 13874308
windows socket support wizard will only include the header file winsock.h and library wsock32.lib. you can add this after the wizard steps like this

1. Open stdafx.h and add the code..
         #include <afxsock.h>            // MFC socket extensions
2. Open resource.h and add this line after the first line
0
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 300 total points
ID: 13874327
windows socket support wizard will only include the header file winsock.h and library wsock32.lib. you can add this after the wizard steps like this

1. Open stdafx.h and add the code..
         #include <afxsock.h>          // MFC socket extensions
2. Open resource.h and add this line after the first line
        #define IDP_SOCKETS_INIT_FAILED            104
3. Open your application class file, in the function initInstance(), put these code as first statements
         if (!AfxSocketInit())
      {
            AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
            return FALSE;
      }
4. Open resource tab, select String table section add
           IDP_SOCKETS_INIT_FAILED, put the string value also

the 2nd and 4th step is optional (only for getting error message if the socket is not initialized properly)
~roshan
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 13882983
Thankx:)
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Screencast - Getting to Know the Pipeline
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question