CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Apr 2005
    Posts
    1,828

    Problem with WM_COPYDATA

    There is a problem while overriding WM_COPYDATA, it only copies the base address

    Code:
    //Source Application
    COPYDATASTRUCT cpd, cpdProjectName, cpdTitleReportName;
    UINT wind;
    	
    MYDATASTRUCT myStringData;
    WTL::CString strDataToSend  = L"4012";
    CComBSTR localStr(strDataToSend);
    			
    cpd.dwData = 0;			// arbitatry long data to send
    cpd.lpData = localStr.m_str;		// a pointer to the buffer containing 
    				// data to send
    cpd.cbData = localStr.ByteLength()+1;
    			
    copyDataResult = ::SendMessage(pOtherWnd, WM_COPYDATA, (WPARAM)::GetWindowContextHelpId(pOtherWnd), (LPARAM)&cpd);
    ::SendMessage(pOtherWnd, WM_COPYDATA, (WPARAM)0, (LPARAM) (LPVOID)&cpd);c
    copyDataResult = ::SendMessage(pOtherWnd, WM_COPYDATA, (WPARAM)(HWND)pOtherWnd, (LPARAM) (LPVOID)&cpd);

    Code:
    //Destination Application
    LONG CTrendProjectDlg::OnCopyData(UINT wind, LONG cpdL)
    {
    	COPYDATASTRUCT *cpdP;
                    long retVal;
       
    	cpdP = (COPYDATASTRUCT*)cpdL; 
    	m_RxData = (LPCSTR)(cpdP->lpData);
    	
    	double wcstod( const wchar_t *nptr, wchar_t **endptr );
    	dCCCompleted = wcstod(m_RxData, NULL);
    	
    	CWnd *pRxData = GetDlgItem(IDC_ED_RXDATA);
    	pRxData->SetWindowText(m_RxData);
    	retVal = 0;
    	return (retVal);     // return value will be seen bu 32-bit app.
    }
    Can some help me in resolving this?
    Last edited by maverick786us; March 7th, 2011 at 02:37 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured