>Could somebody point me in the right direction for setting up Visual Fox Pro as a DDE Server. I am trying to access a fox pro database from a third-party windows program as the client using DDE functions.
* DDE SERVER
=DDESetService('MYSRV', 'DEFINE')
=DDESetService('MYSRV', 'POKE',.T.)
=DDESetService('MYSRV', 'ADVISE',.T.)
=DDESetService('MYSRV', 'REQUEST',.T.)
=DDESetTopic('MYSRV', 'REQU','clireq') && name of function to call
DO FORM MYSRV
READ EVENTS
* mysrv is a simple form with a quit button
=DDESetService('RELAYSRV', 'RELEASE') && when form is released
CANCEL
*********************************************************
*Processes client requests
FUNCTION clireq
PARAMETER ichannel,saction,sitem,sdata,sformat,istatus
PRIVATE LIKE l_*
l_return=.T.
*Turn off DDE while processing
=DDEENABLED(ichannel,.F.)
*Decide what action to take
DO CASE
*Process a INITIATE
CASE saction='INITIATE'
l_return=.T.
*Process a TERMINATE
CASE saction='TERMINATE'
mysrv.release && release the form
*Process a POKE
CASE saction='POKE'
** put code here to poke
*Process a REQUEST
CASE saction='REQUEST'
*** code here to process a request
ENDCASE
*Turn ON DDE again
=DDEENABLED(ichannel,.T.)
RETURN
Of course there is more to DDE than setting up a server. ADVISE must be called and passed a function name that it will run in the client application when it gets updated data etc.
Hope this Helps
Bernard