Solved

Communicating between CMySocket and the document.........

Posted on 2000-03-25
7
179 Views
Last Modified: 2013-11-20
I have a SDI application with a CMySocket   class derived from the CSocket class. I have CSocketFile archive all ready and pumping data in and out fine...



Now i want to update one of my document data from the OnRecieve of my CMysocket class and then call UpdateAllViews();

How can i communicate between CMySocket and document clss  ie set  some document data from the OnRecieve handle of CMySocket class.


thanks
0
Comment
Question by:ghimireniraj
  • 4
  • 3
7 Comments
 
LVL 8

Expert Comment

by:VinExpert
ID: 2657192
Hi,

Have U tried with,

CAAADoc *pDoc = AfxGetMainWnd()->GetDocument();
pDoc->strData += Incomingdata;

For that U may have to include AAADoc.h file

Try it out.
VinExpert
0
 
LVL 3

Author Comment

by:ghimireniraj
ID: 2657233
>CAAADoc *pDoc = AfxGetMainWnd()->GetDocument();

GetDocument() is not a member of CWnd class
0
 
LVL 8

Accepted Solution

by:
VinExpert earned 50 total points
ID: 2657348
Hi,

I am sorry, here it is

CFileDlgDoc *pDoc = (CFileDlgDoc *)((CMainFrame *)AfxGetMainWnd())->GetActiveView()->GetDocument();
      pDoc->strData = "dfdf";

U have to include doc.h and mainframe.h files for it.

Try it out.

VinExpert
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 3

Author Comment

by:ghimireniraj
ID: 2658864
The solution was absolutely great .I want to give you more points but i just have 50 right now....
0
 
LVL 3

Author Comment

by:ghimireniraj
ID: 2658866
The solution was absolutely great .I want to give you more points but i just have 50 right now....
0
 
LVL 3

Author Comment

by:ghimireniraj
ID: 2658879
I had also solved the problem with a crazy way.

I declared a pointer for my view class
globally  like
CSendView* view1;
 then i used  it as in my socket file as

extern  CSendView* view1;

in the initial update of the CSendView
class i had written

view1=this;


But you solution is far better and i will switch to that. It also taught me how i can typecast anduse pointers in other situations.

niraj
0
 
LVL 8

Expert Comment

by:VinExpert
ID: 2660989
Hi,

:) well, there will be many solutions to a prob. But, try not use global variables.

VinExpert
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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…
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.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

803 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