Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sending value from VFP to .NET
Message
De
23/06/2009 10:12:43
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Sending value from VFP to .NET
Divers
Thread ID:
01407784
Message ID:
01407784
Vues:
132
Dear Experts,

Greetings to all. I'm new to .Net and started learning it recently. I want to send value from my VFP application into .Net application. One of my friend is helping me on this project. He gave me one code which works fine, and sends the message from VFP. Only problem with this code is the value which is received in the .Net application is not a actual sent value from, its some junk value. Can anyone pls help me know whats going wrong and where.

Thank you in advance.

Sunil Sawant.


Here is the code
*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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform