*LPARAMETERS lcdata lcdata="9820098200" Declare Long FindWindow In user32 String ClassName, String WindowTitle handle = FindWindow(Null, "CaptureData") If handle>0 CopyData(handle,0, lcdata,1351) Else Messagebox("CaptureData Window Not Found") Endif *CopyData( _vfp.HWnd,0 , "Some Data", 1351) Procedure CopyData Lparameter tnDstHWND,tnSrcHWND, tcData, tnIdentifier *-------------------------------------------------------------------------------------- * Declare API functions *-------------------------------------------------------------------------------------- *Declare Long HeapAlloc In win32api Long, Long, Long Declare LONG GlobalAlloc IN "kernel32" LONG wFlags, LONG dwBytes Declare Long GetProcessHeap In win32api Declare Long HeapFree In win32api Long, Long, Long #Define WM_COPYDATA 0x004A *#define WM_COPYDATA 0x004A *-------------------------------------------------------------------------------------- * Create a COPYDATASTRUCT structure *-------------------------------------------------------------------------------------- Local lcStruct, lnMem *lnMem1 = HeapAlloc( GetProcessHeap(),4,Len(m.tcData)*2 ) lnMem =GlobalAlloc( 0, len(m.tcData)*2) lcStruct = ; BINTOC(m.tnIdentifier,"4rs") + ; bintoc(Len(m.tcData)*2,"4rs") + ; bintoc(m.lnMem,"4rs")+m.tcdata abc=Sys(2600,m.lnMem,LEN(m.lcStruct),m.lcStruct) *-------------------------------------------------------------------------------------- * Send data to the other application *-------------------------------------------------------------------------------------- Local lnRetVal Declare Long SendMessage In win32api Long, Long, Long, Long lnRetVal = SendMessage( m.tnDstHWND, WM_COPYDATA, _vfp.hWnd , lnMem ) *-------------------------------------------------------------------------------------- * Free up memory *-------------------------------------------------------------------------------------- HeapFree( GetProcessHeap(), 0, m.lnMem ) ?lnRetVal