Solved

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

Posted on 2000-03-25
7
182 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 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
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!

 
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

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
canBalance challenge 34 104
fix34  challenge 9 164
Thin secure Windows 10 5 107
how to split multiple lines delimiter : 8 119
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.

735 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