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
Solved

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

Posted on 2000-03-25
7
180 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand data scrubbing tool 13 35
Tab names are off by one 5 54
MaxSpan challenge 9 105
unix example issues 18 98
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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…
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

860 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