CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2004
    Location
    DeathValley
    Posts
    184

    Socket programming question

    Hi, please have a look at the attachment, it is a sample from the book Teach Yourself VC++ in 21 days, which is a dialog based application and has both client and server functionality in the same dialog resource. It has a function called SetParent, and a member variable of the type CDialog* as its parameter.

    I need to make a similar application, but I wish to incorporate the client and the server independently, and also, as SDI or MDI applications, instead of dialog based. I tried to use similar approach as in this example, and seperated client and server functionalities into two different applications, but I get a huge number of errors.

    The following are the changes I made

    Instead of the CDialog* varialbe type, I used a CFormview* variable,as it is an SDI application.
    I used the SetParent function with this variable as the parameter.

    Where am I doing wrong here? I am unable to figure it out. Please help.
    Attached Files Attached Files
    Last edited by ur_unholyness; March 8th, 2005 at 02:04 AM.

  2. #2
    Ejaz's Avatar
    Ejaz is offline Elite Member Power Poster
    Join Date
    Jul 2002
    Location
    Lahore, Pakistan
    Posts
    4,211

    Re: Socket programming question

    The code that posted has no problem, its a simple dialog based application, which works fine. You should post the code that is having the problem.

    Btw, you can get better answer from Network Programming

  3. #3
    Join Date
    Dec 2004
    Location
    DeathValley
    Posts
    184

    Re: Socket programming question

    Thank you Mr. Ejaz, I will post it there again, but it would be a great help if you could help me with two answers :

    In the sample I uploaded, since it is a dialog based one, it uses the CDialog* variable in the SetParent function. If I were to use most of the same code as in the sample, but in an MDI based application, what do I substitute this CDialog* variable with?.

    I guess the SetParent function is used to attach the WinSock functionalities to a view, so if one of the views in my MDI application needs network functionalities, how do I attach them to it using this CMySocket class.

  4. #4
    Ejaz's Avatar
    Ejaz is offline Elite Member Power Poster
    Join Date
    Jul 2002
    Location
    Lahore, Pakistan
    Posts
    4,211

    Re: Socket programming question

    You can set the pointer of whoever owns the socket, replace the pointer of CDialog with the class which has the socket in it.

  5. #5
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: Socket programming question

    [ Moved thread ]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured