>I am trying to enable asynchronous DDE comunications between my VFP5 app and a C program. I have succeeded with DDE between two VFP 'prg' files each running under a seperate Windows' session. I want to duplicate this using VFP SDI forms.
>
>I have the following code in one of my Form's INIT Method:
>
>* Set-Up Server
>=DDESetService('VFP','DEFINE')
>=DDESetService('VFP','EXECUTE',.T.)
>=DDESetService('VFP','REQUEST',.T.)
>=DDESetService('VFP','POKE',.T.)
>
>* Set-Up our main topic and the UDF name that
>* will handle the DDE message we are processing.
>
>WITH This
> .cItem = 'MYCMD'
> = DDESetTopic('VFP',.cItem,'Thisform.dispatch')
> * Become Client for C++ program
> .nChannel = DDEInitiate('CPP',.cItem)
>ENDWITH
>
>When I run the form, I get an error while the program tries to execute the command :
>
> = DDESetTopic('VFP',.cItem,'Thisform.dispatch')
>
>For some reason, VFP doesn't recognize 'Thisform.dispatch' as a valid UDF which is meant to be executed when the Server sends data back to the form.
>
>I need to initialize DDE comunication from within a form so that I can display data sent to me from the DDE Server.
>
>What to do?
>
>Any help is appreciated...
I haven't done this directly from a form but what we did do that worked was creating a custom object that held all the methods for initiating/query-response/shutdown of a C++ (V1.52 is that matters) server. The C program is called with a request_buffer and a response_buffer as outbuf=interFaceC(inbuf). The C programs is a out of process exe that is simply started with a RUN command. The DDEInitiate refers the server name exposed by the C program. We had needed this to interface with a 16 bit Unix C packages ported to Windows (mostly) and the C server we wrote acts a intermediator between VFP and the unix software. We had tried using callfn/regfn etc. but ran into many problems with the unix package port.
HTH
Gary
Helping Make Ideas Reality