Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Win/Windows File Streams
Function:
Required plugins for this example: MBS Util Plugin, MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Windows File Streams
This example is the version from Sat, 26th Aug 2016.
Project "Windows File Streams.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control ListButton Inherits PushButton
ControlInstance ListButton Inherits PushButton
EventHandler Sub Action() dim f as FolderItem = GetOpenFolderItem("") if f <> nil then ListStreams f end if End EventHandler
End Control
Control CreateButton Inherits PushButton
ControlInstance CreateButton Inherits PushButton
EventHandler Sub Action() dim f as FolderItem = GetSaveFolderItem("", "test.txt") if f <> nil then dim t as TextOutputStream = TextOutputStream.Create(f) t.WriteLine "Hello World" t.Close dim b as LargeBinaryStreamMBS = LargeBinaryStreamMBS.WinCreateStream(f, "test") if b = nil then MsgBox "Failed to create Stream." else b.Write "Additional data in test stream." b.Close end if end if End EventHandler
End Control
Control CreateButton1 Inherits PushButton
ControlInstance CreateButton1 Inherits PushButton
EventHandler Sub Action() dim f as FolderItem = GetOpenFolderItem("") if f <> nil then dim b as LargeBinaryStreamMBS = LargeBinaryStreamMBS.WinOpenStream(f, "test", false) if b = nil then MsgBox "Failed to open Stream." else dim r as string = b.Read(b.Length) MsgBox r end if end if End EventHandler
End Control
Sub ListStreams(f as FolderItem) List.DeleteAllRows dim l() as WindowsFileStreamMBS = WindowsFileStreamMBS.List(f) if l = nil then break // failed else for each w as WindowsFileStreamMBS in l List.AddRow w.Name, str(w.size) next end if End Sub
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project

See also:

Feedback, Comments & Corrections

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




Links
MBS Xojo Plugins