?
Solved

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

Posted on 2000-03-25
7
Medium Priority
?
187 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
[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
  • 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 200 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
Technology Partners: 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!

 
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

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

765 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