SendMessage 
Author Message
 SendMessage

I've a problem with the SendMessage API.
I'm trying to send a message from my CDocument's derived class to its View
but I get an Access Violation Error when I run it in release mode (while in
debug mode it seems to works fine). To solve the problem  I write a very
small SDI application in which I try to send this message but I get the
error again. Here is the significant code of my application; if someone
could help me I would appreciate it a lot.

WHEN THE USER CLICK ON BUTTON1 IN THE VIEW:

void CTempView::OnButton1()
{
 // TODO: Add your control notification handler code here

GetDocument()->Send(((CTempView*)((CTempApp*)AfxGetApp())->m_pMainWnd)->GetS
afeHwnd());

Quote:
}

IN THE CLASS CTEMPDOC (DERIVED FROM CDOCUMENT) THE PROTOTYPE OF SEND METHOD

 LRESULT Send(HWND hWnd);

AND ITS DEFINITION

LRESULT CTempDoc::Send(HWND hWnd)
{
 m_hWndOwner = hWnd;
 return SendMessage(m_hWndOwner,WM_COMMAND,MSG_SAX_FAIL,NULL);

Quote:
}

Best regards
--
Marco Vecchi
VENTURINI & C. Spa
Indirizzi E-Mail




Tue, 25 Feb 2003 22:46:41 GMT  
 SendMessage
Marco:

But how are you handling this message in the view class?

David Wilkinson

===============

Quote:

> I've a problem with the SendMessage API.
> I'm trying to send a message from my CDocument's derived class to its View
> but I get an Access Violation Error when I run it in release mode (while in
> debug mode it seems to works fine). To solve the problem  I write a very
> small SDI application in which I try to send this message but I get the
> error again. Here is the significant code of my application; if someone
> could help me I would appreciate it a lot.

> WHEN THE USER CLICK ON BUTTON1 IN THE VIEW:

> void CTempView::OnButton1()
> {
>  // TODO: Add your control notification handler code here

> GetDocument()->Send(((CTempView*)((CTempApp*)AfxGetApp())->m_pMainWnd)->GetS
> afeHwnd());
> }

> IN THE CLASS CTEMPDOC (DERIVED FROM CDOCUMENT) THE PROTOTYPE OF SEND METHOD

>  LRESULT Send(HWND hWnd);

> AND ITS DEFINITION

> LRESULT CTempDoc::Send(HWND hWnd)
> {
>  m_hWndOwner = hWnd;
>  return SendMessage(m_hWndOwner,WM_COMMAND,MSG_SAX_FAIL,NULL);
> }

> Best regards
> --
> Marco Vecchi
> VENTURINI & C. Spa
> Indirizzi E-Mail





Wed, 26 Feb 2003 09:11:10 GMT  
 SendMessage


Fri, 19 Jun 1992 00:00:00 GMT  
 SendMessage

I had not included the handler for the message because I'm quite sure that
the problem isn't there. In fact the handler is simply an update of an Edit
Control of the view. Here it is.

LRESULT CTempView::OnFail(WPARAM wParam, LPARAM lParam)
{
 m_sEdit1 = "Messaggio ricevuto";
 UpdateData(false);
 return (0);

Quote:
}

Marco Vecchi


Quote:
> Marco:

> But how are you handling this message in the view class?

> David Wilkinson

> ===============


> > I've a problem with the SendMessage API.
> > I'm trying to send a message from my CDocument's derived class to its
View
> > but I get an Access Violation Error when I run it in release mode (while
in
> > debug mode it seems to works fine). To solve the problem  I write a very
> > small SDI application in which I try to send this message but I get the
> > error again. Here is the significant code of my application; if someone
> > could help me I would appreciate it a lot.

> > WHEN THE USER CLICK ON BUTTON1 IN THE VIEW:

> > void CTempView::OnButton1()
> > {
> >  // TODO: Add your control notification handler code here

GetDocument()->Send(((CTempView*)((CTempApp*)AfxGetApp())->m_pMainWnd)->GetS

- Show quoted text -

Quote:
> > afeHwnd());
> > }

> > IN THE CLASS CTEMPDOC (DERIVED FROM CDOCUMENT) THE PROTOTYPE OF SEND
METHOD

> >  LRESULT Send(HWND hWnd);

> > AND ITS DEFINITION

> > LRESULT CTempDoc::Send(HWND hWnd)
> > {
> >  m_hWndOwner = hWnd;
> >  return SendMessage(m_hWndOwner,WM_COMMAND,MSG_SAX_FAIL,NULL);
> > }

> > Best regards
> > --
> > Marco Vecchi
> > VENTURINI & C. Spa
> > Indirizzi E-Mail





Fri, 28 Feb 2003 14:36:24 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. C++ SendMessage equivalent in C# ???

2. SendMessage.

3. Trapping SendMessage via interop services

4. SendMessage with C#

5. How to send string with SendMessage?

6. HELP: SendMessage and CB_GETLBTEXT in C#

7. Newbie: pls help with SendMessage

8. Question: using SendMessage via DllImport

9. SendMessage or Alternative for IPC?

10. SendMessage program in Novell Network

11. SendMessage for PopUP Help

12. Sendmessage HELP !!

 

 
Powered by phpBB® Forum Software