Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Win/Windows DDE/List Excel Topics
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/List Excel Topics
This example is the version from Sun, 17th Mar 2012.
Project "List Excel Topics.rbp"
Class Window1 Inherits Window
Binding enablingBinder
Control List Inherits ListBox
ControlInstance List Inherits ListBox
End Control
Control celle Inherits TextField
ControlInstance celle Inherits TextField
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control value Inherits TextField
ControlInstance value Inherits TextField
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() setvalue End EventHandler
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
EventHandler Sub EnableMenuItems() filecloseFIleinExcel.enable filenewSheetinExcel.enable fileupdatelist.enable End EventHandler
EventHandler Sub Open() update End EventHandler
Function FileCloseFIleinExcel() As Boolean excelexecute "[FILE.CLOSE(0)]" return true End Function
Function FileNewSheetinExcel() As Boolean excelexecute "[NEW(1)]" return true End Function
Function FileUpdatelist() As Boolean update return true End Function
Sub excelexecute(p as string) dim d as DDEMBS dim s,topic as DDEStringMBS dim g as DDEBinaryDataMBS dim t,enter,z as string dim i,c as integer dim b as boolean d=new DDEMBS if d.InitClient then s=d.newDDEString("Excel") topic=d.newDDEString("System") if topic<>nil and s<>nil and d.ConnectToServer(s,topic) then g=d.newDDEBinaryData(nil,p) if g<>nil then b=d.ClientTransactionBoolean(d.XTYP_EXECUTE,nil,g) if b then msgBox "Call okay." else msgBox "Failed to transfer." end if else msgBox "Fail to create second string." end if g=nil // must be released before close else msgBox "Fail to create connect." end if s=nil // must be released before close d.close else msgBox "Fail to init for Client." end if End Sub
Sub setvalue() dim d as DDEMBS dim s,topic as DDEStringMBS dim g as DDEStringMBS dim m as DDEBinaryDataMBS dim t,enter,z,n as string dim i,c as integer dim b as boolean d=new DDEMBS if d.InitClient then s=d.newDDEString("Excel") n=list.cell(list.ListIndex,0) topic=d.newDDEString(n) if topic<>nil and s<>nil and d.ConnectToServer(s,topic) then g=d.newDDEString(celle.text) m=d.newDDEBinaryData(nil, value.text) if g<>nil and m<>nil then b=d.ClientTransactionBoolean(d.XTYP_POKE,g,m) if b then msgBox "Transfer okay." else msgBox "Failed to transfer." end if else msgBox "Fail to create second string." end if g=nil // must be released before close else msgBox "Fail to create connect." end if s=nil // must be released before close d.close else msgBox "Fail to init for Client." end if End Sub
Sub update() dim d as DDEMBS dim s,topic as DDEStringMBS dim g as DDEStringMBS dim m as DDEBinaryDataMBS dim t,enter,z as string dim i,c as integer list.deleteAllRows d=new DDEMBS if d.InitClient then s=d.newDDEString("Excel") topic=d.newDDEString("System") if topic<>nil and s<>nil and d.ConnectToServer(s,topic) then g=d.newDDEString("Topics") if g<>nil then m=d.ClientTransaction(d.XTYP_REQUEST,g) if m<>nil then t=m.str t=left(t,len(t)-1) // remove chr(0) at end enter=chr(9) c=countfields(t,Enter) for i=1 to c z=nthfield(t,enter,i) list.addRow z next list.listindex=0 else msgBox "Failed to transfer." end if else msgBox "Fail to create second string." end if g=nil // must be released before close else msgBox "Fail to create connect." end if s=nil // must be released before close d.close else msgBox "Fail to init for Client." end if End Sub
End Class
MenuBar Menu
MenuItem UntitledMenu5 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileUpdatelist = "Update list"
MenuItem UntitledMenu4 = "-"
MenuItem FileNewSheetinExcel = "New Sheet in Excel"
MenuItem FileCloseFIleinExcel = "Close FIle in Excel"
MenuItem UntitledMenu3 = "-"
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 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