DDE problem

Windows specific forum
MKL
New User
New User
Posts: 1
Joined: Wed Dec 28, 2005 8:49 pm

DDE problem

Post by MKL »

hi,

i'm just starting programming purebasic but i have some problems with DDE, i found this example on this forum:


Global DDEServerName.s
DDEServerName = "kepdde"
Global idInst.l
Global hItemMessage.l
;Global hData.l
Global hconvServer.l
Global myresult


#TIMEOUT_SYNC = 5
#XCLASS_BOOL = $1000
#XCLASS_NOTIFICATION = $8000
#XTYPF_NOBLOCK = $2
#XTYP_CONNECT = $60 | #XCLASS_BOOL | #XTYPF_NOBLOCK
#XTYP_DISCONNECT = $C0 | #XCLASS_NOTIFICATION | #XTYPF_NOBLOCK

#CP_WINANSI = 1004 ;' Default codepage For windows & old DDE convs.
#SW_RESTORE = 9
#DDE_FACK = $8000
#XCLASS_FLAGS = $4000
#XTYP_EXECUTE = $50 | #XCLASS_FLAGS
#CF_TEXT = 1
#XTYP_POKE = $90 | #XCLASS_FLAGS
;}

Procedure.l DDECallback(uType,uFmt, hConv , hszTopic, hszItem, hData,dwData1, dwData2)
ReturnValue=0;#DDE_FACK
Select uType
Case #XTYP_EXECUTE
ReturnValue=0
Case #XTYP_POKE
ReturnValue = #DDE_FACK
EndSelect
ProcedureReturn ReturnValue
EndProcedure

Procedure ddeinit(DDETopicName.s)
DdeInitialize_(@idInst, @DDECallback(), #APPCLASS_STANDARD | #APPCMD_CLIENTONLY , 0)
hszServer = DdeCreateStringHandle_(idInst, DDEServerName, #CP_WINANSI)
hszTopic = DdeCreateStringHandle_(idInst, DDETopicName, #CP_WINANSI)
;try To find the first instance, connect
hconvServer = DdeConnect_(idInst, hszServer, hszTopic, 0)
EndProcedure

Procedure.l DDEEXECUTE (comand$)
Delay(200)
hItemMessage = DdeCreateStringHandle_(idInst, comand$, #CP_WINANSI )
Result = DdeClientTransaction_(@comand$, Len(comand$), hconvServer, hItemMessage, #CF_TEXT, #XTYP_EXECUTE, #TIMEOUT_SYNC, 0) ; execute
DdeFreeStringHandle_( idInst, hItemMessage)
ProcedureReturn Result
EndProcedure

;****************
;* PROGRAM INIT *
;****************



ddeinit("IFSCOM1_DL06") ;converstion with workbook


Delay(100000)


Result=DdeFreeStringHandle_( idInst, hItemMessage)
DdeFreeDataHandle_(hData) ; for ddegetdata()


and if i run it it will connect to a server and i can execute commando's but how do i read from the DDE server and how can i put it in a variable?
i want to read the item : "etik" from the server"

i hope somebody can help me.

regards