Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Win/Windows DDE/DDE Server
Function:
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Windows DDE/DDE Server
This example is the version from Sun, 17th Mar 2012.
Project "DDE Server.rbp"
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control EditField1 Inherits TextField
ControlInstance EditField1 Inherits TextField
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control InitButton Inherits PushButton
ControlInstance InitButton Inherits PushButton
EventHandler Sub Action() dim s as DDEStringMBS if d<>nil then s=d.newDDEString(editfield1.text) if s<>nil then if d.registerService(s) then msgBox "Registered." else msgBox "Register fails." end if else msgBox "Failed on NewDDEString" end if else msgBox "No DDE object!?" end if exception e msgBox "Exception in InitButton.Action" End EventHandler
End Control
EventHandler Sub Close() d.close d=nil End EventHandler
EventHandler Sub Open() d=new subDDE d.list=list if d.InitServer then else msgBox "Failed InitServer" end if End EventHandler
Property d As subDDE
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class SubDDE Inherits DDEMBS
EventHandler Function AdviceData(topic as DDEStringMBS, item as DDEStringMBS, dataformat as integer,data as DDEBinaryDataMBS) As integer list.addRow "AdviceData. Topic: "+st(topic)+", item: "+st(item)+", format: "+str(dataformat) return me.DDE_FACK //ok exception e msgBox "Exception in SubDDE.AdviceData." End EventHandler
EventHandler Function AdviceRequest(topic as DDEStringMBS, item as DDEStringMBS, dataformat as integer,remaincount as integer) As DDEBinaryDataMBS list.addRow "AdviceRequest. Topic: "+st(topic)+", item: "+st(item)+", format: "+str(dataformat)+" remaincount: "+str(remaincount) return nil // nothing to give exception e msgBox "Exception in SubDDE.AdviceRequest." End EventHandler
EventHandler Function AdviceStart(topic as DDEStringMBS, item as DDEStringMBS, dataformat as integer) As Boolean list.addRow "AdviceStart. Topic: "+st(topic)+", item: "+st(item)+", format: "+str(dataformat) return true // give advise exception e msgBox "Exception in SubDDE.AdviceStart." End EventHandler
EventHandler Sub AdviceStop(topic as DDEStringMBS, item as DDEStringMBS, dataformat as integer) list.addRow "AdviceStop. Topic: "+st(topic)+", item: "+st(item)+", format: "+str(dataformat) exception e msgBox "Exception in SubDDE.AdviceStop." End EventHandler
EventHandler Sub ConfirmConnect(topic as DDEStringMBS, service as DDEStringMBS, myself as Boolean,info as DDEContextInfoMBS) list.addRow "ConfirmConnect. Topic: "+st(topic)+", item: "+st(service) exception e msgBox "Exception in SubDDE.ConfirmConnect." End EventHandler
EventHandler Function Connect(topic as DDEStringMBS, service as DDEStringMBS, myself as Boolean,info as DDEContextInfoMBS) As Boolean dim s as string list.addRow "Connect. Topic: "+st(topic)+", item: "+st(service) if info<>Nil then if info.ansi then s="Ansi" elseif info.unicode then s="Unicode" else s="?" end if list.addrow " Encoding: "+s+", Language: "+str(info.langID)+", Country: "+str(info.countryID) end if return true exception e msgBox "Exception in SubDDE.Connect." End EventHandler
EventHandler Sub Disconnect(myself as Boolean) list.addRow "Disconnect." exception e msgBox "Exception in SubDDE.Disconnect." End EventHandler
EventHandler Sub Error(errorcode as integer) list.addRow "Error. errorcode: "+str(errorcode) exception e msgBox "Exception in SubDDE.Error." End EventHandler
EventHandler Function Execute(topic as DDEStringMBS,data as DDEBinaryDataMBS) As integer dim s as string list.addRow "Execute. Topic: "+st(topic) s=data.Str if s="msgbox" then msgBox "Hello World!" return me.DDE_FACK else return me.DDE_FNOTPROCESSED // I want only my msgbox and nothing else. end if exception e msgBox "Exception in SubDDE.Execute." End EventHandler
EventHandler Function Poke(topic as DDEStringMBS,item as DDEStringMBS,data as DDEBinaryDataMBS) As integer list.addRow "Poke. Topic: "+st(topic)+", Item: "+st(item) return me.DDE_FACK exception e msgBox "Exception in SubDDE.Poke." End EventHandler
EventHandler Sub Register(application as DDEStringMBS,service as DDEStringMBS) list.addRow "Register. Topic: "+st(application)+", Item: "+st(service) exception e msgBox "Exception in SubDDE.Register." End EventHandler
EventHandler Function Request(topic as DDEStringMBS,item as DDEStringMBS,dataformat as integer) As DDEBinaryDataMBS list.addRow "Request. Topic: "+st(topic)+", Item: "+st(item)+", format: "+str(dataformat) return me.NewDDEBinaryData(nil,"Hello World!") exception e msgBox "Exception in SubDDE.Request." End EventHandler
EventHandler Sub UnRegister(application as DDEStringMBS,service as DDEStringMBS) list.addRow "unregister. Topic: "+st(application)+", Item: "+st(service) exception e msgBox "Exception in SubDDE.Unregister." End EventHandler
EventHandler Function WildConnect(topic as DDEStringMBS,service as DDEStringMBS, myself as boolean,info as DDEContextInfoMBS) As DDEStringPairListMBS dim l as DDEStringPairListMBS dim p as DDEStringPairMBS p=new DDEStringPairMBS p.Service=NewDDEString("MyService") p.Topic=NewDDEString("MyTopic") l=new DDEStringPairListMBS l.Append p list.addRow "Wild Connect. Topic: "+st(topic)+", item: "+st(service) return l exception e msgBox "Exception in SubDDE.WildConnect." End EventHandler
Function St(s as ddestringmBS) As string if s<>nil then return s.Str end if End Function
Property list As listbox
End Class
Class App Inherits Application
End Class
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Win Plugin.




Links
MBS FileMaker Plugins