Solved

Simply question

Posted on 2003-12-02
7
233 Views
Last Modified: 2013-11-20
Okay i have a program that I wrote in visual basic which I have had trouble converting it into MFC can someone help me out on how i can convert the code to MFC?

This code as you can see connects to port 4443, listens for data, puts the received data on a list box and if the Option1 radio button is clicked it closes the port for listening.

Visual Basic Code:

Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
List1.AddItem "Time: " & Time & " - " & Winsock1.RemoteHostIP & " - Direct Connect"
Winsock1.Close
Winsock1.LocalPort = 4443
Winsock1.Listen
End Sub
--------------------------
Private Sub Option1_Click()
If Option1.Value = True Then Winsock1.Close
End Sub
0
Comment
Question by:sdgaf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9864112
you can use the WinSoct Control in VC using the "Project->Add To Project->Components and Controls" menu.
This will givee you a wrapper class of winsock, call the same functions with brackets....becoz vc uses set/get functions instead of properties.

Rosh :)
0
 

Author Comment

by:sdgaf
ID: 9868655
I used the following code and got errors saying Winsock1 undeclared. and LocalPort, Listen, and Close must point to a struct/class

Winsock1.LocalPort( 4443 );
Winsock1.Listen();
..
..
Winsock1.Close();
0
 

Expert Comment

by:Drew_Benton
ID: 9892065
Ok as in roshmon's post, add that component. But there is more stuff you need to do to use this control. Open up your main Dialog, drag the new component (Miscrosoft WinSock Control 6.0 ) onto the dialog. Now hold down "ctrl" and double click on the winsock control. A new dialog should pop up, "Add Member Variable" for the name make it "Winsock1". Now hit ok. Now your code will work. ( I hope =) )
- Drew
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:Drew_Benton
ID: 9892067
Clarification: "double click on the winsock control" thats on your dialog.
0
 

Author Comment

by:sdgaf
ID: 9893723
I do not see the winsock control in 6.0. I see every other control except for winsock. How do i get the winsock????
0
 

Expert Comment

by:Drew_Benton
ID: 9893854
ok do this:
Project ( at the top of the VC++ Window)->Add To Project (second item in the menu)->Components and Controls (the last item in that menu)
A new window will pop up, double click on the "Registered ActiveX Controls" folder to open it, then look for "Microsoft WinSock Control, version 6.0" (listed by alpha) so scroll midway into the 'M's'. When you find it double click on it. A confirmation will appear, hit Ok. A new dialog will popup, hit ok again, then close the "Components and Controls Gallery" window. Now try to do as I mentioned above. If you have any more ques feel free to ask.
0
 

Accepted Solution

by:
khaotiksociety earned 250 total points
ID: 9902399
Thanks, If you have any questions IM me
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

728 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