passing 4 parameters in SendMessage()
-
now there is no error But when i m accessing it my MessageMap function like this:- recv_val *obj_recv = static_cast(lparam); its giving an error:- error C2440: 'static_cast' : cannot convert from 'long' to 'struct recv_val *' recv val is also a structure in other class in which i m having my messagemap struct recv_val { CString Recv_URL; CString Recv_name; int Recv_index; };
sulabh_expert@rediffmail.com wrote:
recv_val *obj_recv = static_cast(lparam);
See replies below. -- modified at 3:29 Tuesday 20th March, 2007
Prasad Notifier using ATL | Operator new[],delete[][^]
-
sulabh_expert@rediffmail.com wrote:
recv_val *obj_recv = static_cast(lparam);
See replies below. -- modified at 3:29 Tuesday 20th March, 2007
Prasad Notifier using ATL | Operator new[],delete[][^]
same error is coming..........
-
now there is no error But when i m accessing it my MessageMap function like this:- recv_val *obj_recv = static_cast(lparam); its giving an error:- error C2440: 'static_cast' : cannot convert from 'long' to 'struct recv_val *' recv val is also a structure in other class in which i m having my messagemap struct recv_val { CString Recv_URL; CString Recv_name; int Recv_index; };
sulabh_expert@rediffmail.com wrote:
struct recv_val { CString Recv_URL; CString Recv_name; int Recv_index; };
Make sure the struct is properly defined. In the sender side you defined as int, CString, CString... You can typecaste as below,
struct recv_val* pStruct = (recv_val*)(LPVOID)lParam;
Do your Duty and Don't expect the Result
-
sulabh_expert@rediffmail.com wrote:
struct recv_val { CString Recv_URL; CString Recv_name; int Recv_index; };
Make sure the struct is properly defined. In the sender side you defined as int, CString, CString... You can typecaste as below,
struct recv_val* pStruct = (recv_val*)(LPVOID)lParam;
Do your Duty and Don't expect the Result
using C style cast is the simplicity mistake...;P
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
same error is coming..........
Use reinterpret_cast.
recv_val *obj_recv = reinterpret_cast<recv_val*>(lParam);
Prasad Notifier using ATL | Operator new[],delete[][^]
-
same error is coming..........
-
sulabh_expert@rediffmail.com wrote:
struct recv_val { CString Recv_URL; CString Recv_name; int Recv_index; };
Make sure the struct is properly defined. In the sender side you defined as int, CString, CString... You can typecaste as below,
struct recv_val* pStruct = (recv_val*)(LPVOID)lParam;
Do your Duty and Don't expect the Result
thanku all my problem got solved..................:)
-
Hi all, My problem is i want to pass 4 variables in my SendMessage function. What i am doing is pasing a single variable and the other three through structure like this :- struct pasiin_val { int index; CString url; CString task_n; }; void CMyThread::LogMessage(CString& logmsg) { if (m_pLogWnd) { pasiin_val obj_val; obj_val.index = test_int; obj_val.url = test_str; obj_val.task_n = test_task_name; m_pLogWnd->SendMessage(LOGMSG, (WPARAM)(CString*)&logmsg, obj_val); } } when i am trying to do this its giving an error:- error C2664: 'SendMessageA' : cannot convert parameter 3 from 'struct pasiin_val' to 'long' can anybody help me in this...... thanks in advance
sulabh_expert@rediffmail.com wrote:
when i am trying to do this its giving an error:- error C2664: 'SendMessageA' : cannot convert parameter 3 from 'struct pasiin_val' to 'long'
better try WM_COPYDATA! http://www.codersource.net/mfc_ipc_wm_copydata.aspx[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta Global Interface Table: An Easy Way to Marshal an Interface Pointer[new] VC Forum Q&A :- I/ IV Support CRY- Child Relief and You
-
now there is no error But when i m accessing it my MessageMap function like this:- recv_val *obj_recv = static_cast(lparam); its giving an error:- error C2440: 'static_cast' : cannot convert from 'long' to 'struct recv_val *' recv val is also a structure in other class in which i m having my messagemap struct recv_val { CString Recv_URL; CString Recv_name; int Recv_index; };
sulabh_expert@rediffmail.com wrote:
recv val is also a structure in other class in which i m having my messagemap struct recv_val { CString Recv_URL; CString Recv_name; int Recv_index; };
The structures must match. :rolleyes:
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
thanku all my problem got solved..................:)
I am facing same issue. My message received at other side but I can access/cast structure at receiving side. Can you specify which one solution works for you?
regards, Divyang Mithaiwala