### Configure and Start NamedPipeServer Source: https://docs.twinbasic.com/tB/Packages/WinNamedPipesLib/NamedPipeServer This example demonstrates configuring a server for free-threaded event delivery with a custom message buffer size, starting the server, and handling the ServerReady event. ```twinBASIC Private WithEvents server As NamedPipeServer Private Sub Form_Load() Set server = New NamedPipeServer server.PipeName = "MyService" server.FreeThreadingEvents = True ' events fire on IOCP worker threads server.MessageBufferSize = 524288 ' 512 KiB initial read buffer server.Start ' creates the IOCP port and worker threads ' server_ServerReady fires asynchronously once all workers have joined End Sub Private Sub server_ServerReady() Debug.Print "server is accepting connections on \\.\pipe\" & server.PipeName End Sub ``` -------------------------------- ### ListView setup and event handling Source: https://docs.twinbasic.com/tB/Packages/WinNativeCommonCtls/ListView Shows how to bind an image list, set the view to lvwReport, define column headers, add list items with subitems, and handle the ItemClick event. The example is a Form_Load and ListView1_ItemClick event pair. ```VB Private Sub Form_Load() ' Bind an image list and configure the view Set ListView1.SmallIcons = ImageList1 ListView1.View = lvwReport ' Define columns ListView1.ColumnHeaders.Add , "name", "Name", 150 ListView1.ColumnHeaders.Add , "type", "Type", 80 ListView1.ColumnHeaders.Add , "size", "Size", 80, lvwColumnRight ' Add rows Dim item As ListItem Set item = ListView1.ListItems.Add(, "doc1", "Report.docx", "doc") item.SubItems(1) = "Word document" item.SubItems(2) = "24 KB" End Sub Private Sub ListView1_ItemClick(Item As ListItem) Debug.Print "Clicked: " & Item.Text End Sub ``` -------------------------------- ### Keyboard shortcut keyString examples Source: https://docs.twinbasic.com/tB/Packages/tbIDE/KeyboardShortcuts Examples of key combination strings used in the Add method. ```text "{CTRL}d" | Ctrl + D "{CTRL}{SHIFT}d" | Ctrl + Shift + D "{ALT}f" | Alt + F "f1" | F1 (no modifier) ``` -------------------------------- ### Example Runtime Versioned Path Source: https://docs.twinbasic.com/tB/Packages/CEF An example of the final directory structure for the v145 Win64 runtime. ```text %LocalAppData%\twinBASIC_CEF_Runtime\145_0_7632_160_Win64\ ``` -------------------------------- ### Initialize and Start NamedPipeServer Source: https://docs.twinbasic.com/tB/Packages/WinNamedPipesLib/NamedPipeServer Demonstrates how to instantiate a NamedPipeServer, configure the pipe name, and start the server instance. ```vb Private WithEvents server As NamedPipeServer Private Sub Form_Load() Set server = New NamedPipeServer ' constructor runs here server.PipeName = "MyService" server.Start End Sub ``` -------------------------------- ### Services.LaunchService Source: https://docs.twinbasic.com/tB/Packages/WinServicesLib/Services Starts an installed service by name and optionally passes launch arguments through to its ServiceManager.LaunchArgs field. Raises run-time error 5 if the SCM cannot be opened, the service is not installed, the caller lacks the Start permission, or StartServiceW fails. ```APIDOC ## Services.LaunchService ### Description Starts an installed service by name and optionally passes launch arguments through to its ServiceManager.LaunchArgs field. ### Syntax Services.LaunchService ServiceName [, LaunchArgs ...] ### Parameters - **ServiceName** (String) - Required - The name of an installed service. - **LaunchArgs** (ParamArray) - Optional - Values forwarded to the service through StartServiceW. Each value is converted to a String; the service-side ITbService.EntryPoint reads them through ServiceManager.LaunchArgs. ### Remarks The method opens the SCM with SC_MANAGER_CONNECT, opens the service with SERVICE_START, and calls StartServiceW. Raises run-time error 5 if the SCM cannot be opened, the service is not installed, the caller lacks the Start permission, or StartServiceW fails (typically because the service is already running). ### Example ' UI side — starting the service with a password argument: Services.LaunchService "MyService", "MySecretPassword" ' Service side — checking the argument inside EntryPoint: Sub EntryPoint(ByVal ServiceManager As ServiceManager) _ Implements ITbService.EntryPoint If Join(ServiceManager.LaunchArgs) <> "MySecretPassword" Then ServiceManager.ReportStatus vbServiceStatusStopped, &H12345678 Exit Sub End If ' ...steady-state work End Sub ``` -------------------------------- ### NamedPipeServer.NumThreadsIOCP Property Source: https://docs.twinbasic.com/tB/Packages/WinNamedPipesLib/NamedPipeServer Gets or sets the number of IOCP worker threads created by Start. Must be set before Start; the value is read once when Start is called and cannot be changed while the server is running. ```APIDOC ## NamedPipeServer.NumThreadsIOCP Property ### Description Gets or sets the number of IOCP worker threads created by Start. Must be set before Start; the value is read once when Start is called and cannot be changed while the server is running. ### Syntax _server_.**NumThreadsIOCP** [ **=** _value_ ] ### Parameters - **value** (Long) - Required - A Long specifying the number of worker threads to create. Default is 1. ### Remarks - One thread is sufficient for most scenarios because every blocking operation inside the worker is an overlapped Win32 call (GetQueuedCompletionStatus) that yields the thread while it waits — the thread is not consumed by I/O wait, only by the time spent inside event handler callbacks. - Raise the count to allow multiple ClientMessageReceived handlers to run concurrently when FreeThreadingEvents is True, or to increase throughput when many clients generate simultaneous completions on multi-core hardware. - When FreeThreadingEvents is False (the default), raising NumThreadsIOCP above 1 produces no throughput gain for event delivery, because all events are serialised through a single hidden window on the UI thread regardless of how many workers produce completions. Multiple threads are useful in that mode only if the IOCP workers themselves perform significant work before posting to the window. ### Example This example configures two worker threads for a server where FreeThreadingEvents is True, allowing two ClientMessageReceived events from different clients to run concurrently. ```vb Private WithEvents server As NamedPipeServer Private Sub Form_Load() Set server = New NamedPipeServer server.PipeName = "MyService" server.NumThreadsIOCP = 2 server.FreeThreadingEvents = True server.Start End Sub ``` ``` -------------------------------- ### Handle WebView Ready event to deploy assets and navigate Source: https://docs.twinbasic.com/Tutorials/CEF/Driving-Monaco In the Ready handler, set the local path to the user's Documents folder, copy the MONACO_DEMO resources, map a virtual host, and navigate to the editor's index.html. This setup is required before Monaco can load. ```twinBASIC Private localPath As String Private Sub WebView_Ready() Handles WebView.Ready localPath = Environ$("USERPROFILE") & "\Documents\tbMonacoDemo" CopyResourcesFolderContentsToLocalPath "MONACO_DEMO", localPath WebView.SetVirtualHostNameToFolderMapping _ "monaco.example", localPath & "\" WebView.Navigate "https://monaco.example/index.html" End Sub ``` -------------------------------- ### Command line example: MyApp /switch arg1 arg2 Source: https://docs.twinbasic.com/tB/Modules/Interaction/Command Shows a sample command line where MyApp is launched with arguments /switch, arg1, and arg2. The Command function returns the string "/switch arg1 arg2". ```text MyApp /switch arg1 arg2 ``` -------------------------------- ### Get statement syntax example Source: https://docs.twinbasic.com/tB/Core/Get Demonstrates the basic syntax for reading from a file using the Get statement with an omitted record number. ```twinbasic Get #4, , FileBuffer ``` -------------------------------- ### Run serve.bat for local preview server Source: https://docs.twinbasic.com/Documentation/Development/Building Starts a localhost server for previewing the documentation. Runs tbdocs --serve, binds to port 4000 (override with --port ), watches the source tree for changes, and auto-reloads browser tabs via SSE after each successful rebuild. Only failures are logged; Ctrl+C exits cleanly. ```batch serve.bat ``` -------------------------------- ### NamedPipeServer.PipeName Property Source: https://docs.twinbasic.com/tB/Packages/WinNamedPipesLib/NamedPipeServer Gets or sets the name the pipe is published under. Must be set to a non-empty value before Start, or Start raises run-time error 5. ```APIDOC ## NamedPipeServer.PipeName Property ### Description Gets or sets the name the pipe is published under. Must be set to a non-empty value before Start, or Start raises run-time error 5. ### Syntax _server_.**PipeName** [ **=** _name_ ] ### Parameters - **name** (String) - Required - A String giving the leaf name for the pipe. The Win32 pipe namespace path is \\.\pipe\ — the package prepends \\.\pipe\ itself; pass just the leaf name (for example, "MyService"). ### Remarks - The value is read at Start time and passed to every CreateNamedPipeW call issued by the IOCP worker threads. Changing PipeName after Start has no effect on the running server. ### Example This example creates a server that publishes under the name "Greeter". The Win32 path a client connects to is \\.\pipe\Greeter. ```vb Private WithEvents server As NamedPipeServer Private Sub Form_Load() Set server = New NamedPipeServer server.PipeName = "Greeter" server.Start End Sub Private Sub server_ServerReady() Debug.Print "listening on \\.\pipe\" & server.PipeName End Sub ``` ``` -------------------------------- ### InstallStartMode Source: https://docs.twinbasic.com/tB/Packages/WinServicesLib/ServiceManager The SCM start mode the service is registered with. ServiceStartConstants, default tbServiceStartOnDemand. ```APIDOC ## InstallStartMode ### Description The SCM start mode the service is registered with. **ServiceStartConstants**, default **tbServiceStartOnDemand**. ### Syntax _manager_.**InstallStartMode** = _value_ ### Parameters _value_ (ServiceStartConstants) - Required - The start mode to register with the SCM. Typical settings: - **tbServiceStartOnDemand** – the service is **not** started automatically; user / installer / **Services.LaunchService** starts it on demand. - **tbServiceStartAuto** – the SCM starts the service at system boot. - **tbServiceStartDisabled** – the service cannot be started until its start mode is changed. The driver-only modes (**tbServiceStartBoot**, **tbServiceStartDriverSystem**) are not meaningful for user-mode twinBASIC services. ### Remarks This property is used during service installation. ``` -------------------------------- ### Mid function example Source: https://docs.twinbasic.com/tB/Modules/Strings/Mid Example usage of the Mid function to extract substrings from a string. Demonstrates returning a specified number of characters and returning from a start position to the end. ```vb Dim MyString, FirstWord, LastWord, MidWords MyString = "Mid Function Demo" ' Create text string. FirstWord = Mid(MyString, 1, 3) ' Returns "Mid". LastWord = Mid(MyString, 14, 4) ' Returns "Demo". MidWords = Mid(MyString, 5) ' Returns "Function Demo". ``` -------------------------------- ### Configure a service instance Source: https://docs.twinbasic.com/tB/Packages/WinServicesLib/Services Demonstrates how to use ConfigureNew to set up a service's properties, including its name, description, type, start mode, command line, and instance creator. ```twinBASIC With Services.ConfigureNew .Name = "MyService" .Description = "An example twinBASIC service" .Type = tbServiceTypeOwnProcess .InstallStartMode = tbServiceStartOnDemand .InstallCmdLine = """" & App.ModulePath & """ -startService" .InstanceCreator = New ServiceCreator(Of MyService) End With ``` -------------------------------- ### Create and display a ToolWindow Source: https://docs.twinbasic.com/tB/Packages/tbIDE/ToolWindow Demonstrates initializing a ToolWindow, configuring its dimensions and content via the RootDomElement, and making it visible. ```vb Private WithEvents myWindow As ToolWindow Private Sub Button1_OnClick() Set myWindow = Host.ToolWindows.Add("MyAddIn.MyWindow", "MyAddIn.MyWindowPosition") With myWindow .Title = "Hello from My AddIn" With .RootDomElement .Properties.suggestedWidth = "400px" .Properties.suggestedHeight = "300px" With .ChildDomElements.Add("greeting", "h1") .Properties.innerText = "Hello, world!" End With End With .Visible = True End With End Sub ``` -------------------------------- ### Day function example Source: https://docs.twinbasic.com/tB/Modules/DateTime/Day Use the Day function to extract the day of the month from a date. The example assigns a date literal to a variable and then calls Day to get the day number, which is stored in another variable. ```vb Dim MyDate, MyDay MyDate = #February 12, 1969# ' Assign a date. MyDay = Day(MyDate) ' MyDay contains 12. ``` -------------------------------- ### DefStr usage example Source: https://docs.twinbasic.com/tB/Core/Deftype Demonstrates setting a default String type for variables starting with letters A through Q. ```vb DefStr A-Q . . . Message = "Out of stack space." ``` -------------------------------- ### Complete single-service EXE setup Source: https://docs.twinbasic.com/tB/Packages/WinServicesLib/ServiceCreator Shows the full configuration and startup logic for a single-service application, including the use of ServiceCreator(Of MyService). ```twinBASIC Module Startup Public Sub Main() With Services.ConfigureNew .Name = "MyService" .Description = "An example twinBASIC service" .Type = tbServiceTypeOwnProcess .InstallStartMode = tbServiceStartOnDemand .InstallCmdLine = """" & App.ModulePath & """ -startService" .InstanceCreator = New ServiceCreator(Of MyService) End With If InStr(Command, "-startService") > 0 Then Services.RunServiceDispatcher ' blocks until the SCM signals shutdown Else MainForm.Show ' control-panel / install UI End If End Sub End Module ``` -------------------------------- ### NamedPipeServer.PipeName Source: https://docs.twinbasic.com/tB/Packages/WinNamedPipesLib/NamedPipeServer Gets or sets the name of the named pipe. This property is required and must be set before calling Start. ```APIDOC ## NamedPipeServer.PipeName ### Description Gets or sets the name of the named pipe. This property is required and must be set before calling Start. ### Property PipeName (String) ### Remarks Set this to a unique name for the pipe. The pipe is opened as PIPE_TYPE_MESSAGE / PIPE_READMODE_MESSAGE. ``` -------------------------------- ### Initialize WebView2 and Map Virtual Host Source: https://docs.twinbasic.com/Tutorials/WebView2/Driving-Monaco The Ready handler sets up the local path for assets, maps the virtual host name to the local folder, and navigates to the Monaco editor index page. ```twinBASIC Private localPath As String Private Sub WebView_Ready() Handles WebView.Ready localPath = Environ$("USERPROFILE") & "\Documents\tbMonacoDemo" CopyResourcesFolderContentsToLocalPath "MONACO_DEMO", localPath WebView.SetVirtualHostNameToFolderMapping _ "monaco.example", localPath & "\", wv2ResourceAllow WebView.Navigate "https://monaco.example/index.html" End Sub ``` -------------------------------- ### GetDeclaredTypeIid example with vbaCastObj Source: https://docs.twinbasic.com/tB/Modules/HiddenModule/GetDeclaredTypeIid Shows how to get the IID for stdole.IPicture and use it with vbaCastObj to cast an object to IUnknown. ```vb Dim Iid As String = GetDeclaredTypeIid(Of stdole.IPicture)() Dim AsPic As IUnknown = vbaCastObj(SomeObj, Iid) ``` -------------------------------- ### Set DependentServices with Array of service names Source: https://docs.twinbasic.com/tB/Packages/WinServicesLib/ServiceManager Assigns an array of service names that this service depends on. The SCM auto-starts these dependencies before starting the service, and aborts the start if any dependency fails. The value is read at Install time. ```twinBASIC .DependentServices = Array("MSMQ", "LanmanServer") ``` -------------------------------- ### InStrRev Example: Find Last Occurrence Source: https://docs.twinbasic.com/tB/Modules/Strings/InStrRev This example uses InStrRev to find the last occurrence of a substring in a string. It demonstrates the default search from the end, a search with a specified start position, and the return value when the substring is not found. ```vb Debug.Print InStrRev("a.b.c", ".") ' 4 — last dot Debug.Print InStrRev("a.b.c", ".", 3) ' 2 — last dot at or before position 3 Debug.Print InStrRev("a.b.c", "x") ' 0 — not found ``` -------------------------------- ### Configure and run services at start-up Source: https://docs.twinbasic.com/tB/Packages/WinServicesLib/Services Configures two services using ConfigureNew and runs the service dispatcher if the application is launched with the -startService command-line argument. ```twinBASIC ' Configure two services at start-up: With Services.ConfigureNew .Name = "MyServiceA" .InstanceCreator = New ServiceCreator(Of MyServiceA) End With With Services.ConfigureNew .Name = "MyServiceB" .InstanceCreator = New ServiceCreator(Of MyServiceB) End With ' Run the dispatcher if launched as a service host: If InStr(Command, "-startService") > 0 Then Services.RunServiceDispatcher ``` -------------------------------- ### Services.InstallAll Source: https://docs.twinbasic.com/tB/Packages/WinServicesLib/Services Iterates every ServiceManager created through ConfigureNew and calls its Install method. Convenience for the typical case where the EXE registers every service it hosts in a single call. ```APIDOC ## Services.InstallAll ### Description Iterates every ServiceManager created through ConfigureNew and calls its Install method. Convenience for the typical case where the EXE registers every service it hosts in a single call. ### Syntax **Services.InstallAll** ### Parameters None. ### Response #### Success Response No return value. ### Remarks InstallAll writes registry entries under HKEY_LOCAL_MACHINE and requires administrator rights. The usual pattern is to call it once from an elevated installer. Per-service errors raised inside ServiceManager.Install propagate out of InstallAll and abort the bulk operation — there is no per-service On Error Resume Next wrapping. Services already installed before the failure remain installed. ``` -------------------------------- ### Asc function example Source: https://docs.twinbasic.com/tB/Modules/Strings/Asc Shows how to use the Asc function to get the character code of the first character in a string. The example returns 65 for "A", 97 for "a", and 65 for "Apple". ```vb Dim MyNumber MyNumber = Asc("A") ' Returns 65. MyNumber = Asc("a") ' Returns 97. MyNumber = Asc("Apple") ' Returns 65. ``` -------------------------------- ### OLEDragMode Property Source: https://docs.twinbasic.com/tB/Packages/VB/QRCode Gets or sets whether an OLE drag is started automatically when the user begins dragging the control. A member of OLEDragConstants. ```APIDOC ## OLEDragMode Property ### Description Gets or sets whether an OLE drag is started automatically when the user begins dragging the control. A member of OLEDragConstants. ### Syntax _object_.**OLEDragMode** [ = _value_ ] ### Parameters - **value** (OLEDragConstants) - Required - vbOLEDragManual (0, default) or vbOLEDragAutomatic (1). ``` -------------------------------- ### _CustomControlTimer.Enabled property Source: https://docs.twinbasic.com/tB/Packages/CustomControls/Framework/_CustomControlTimer Gets or sets whether the timer is currently running. Setting to True starts the timer; setting to False stops it. ```APIDOC ## _CustomControlTimer.Enabled ### Description Gets or sets whether the timer is currently running. Setting to True starts the timer; setting to False stops it. ### Syntax _object_.**Enabled** [ **=** _value_ ] ### Parameters - **value** (Boolean) - Optional - True to start the timer, False to stop it. ### Return Value Boolean - The current enabled state of the timer. ### Remarks Read/write property. ``` -------------------------------- ### Determine file size with LOF Source: https://docs.twinbasic.com/tB/Modules/FileSystem/LOF This example demonstrates how to use the LOF function to get the size of an open file named TESTFILE. ```vb Dim FileLength Open "TESTFILE" For Input As #1 ' Open file. FileLength = LOF(1) ' Get length of file. Close #1 ' Close file. ``` -------------------------------- ### Configure a service with Services.ConfigureNew Source: https://docs.twinbasic.com/tB/Packages/WinServicesLib/ServiceManager Shows the recommended way to create a ServiceManager instance. Must be used instead of constructing directly. Sets the service Name, Description, Type, InstallStartMode, InstallCmdLine referencing App.ModulePath, and InstanceCreator. The InstallCmdLine uses a quoted module path and the -startService flag. ```vb With Services.ConfigureNew .Name = "MyService" .Description = "An example twinBASIC service" .Type = tbServiceTypeOwnProcess .InstallStartMode = tbServiceStartOnDemand .InstallCmdLine = """" & App.ModulePath & """ -startService" .InstanceCreator = New ServiceCreator(Of MyService) End With ``` -------------------------------- ### FileLen Example: Get File Size in Bytes Source: https://docs.twinbasic.com/tB/Modules/FileSystem/FileLen Use FileLen to return the length of a file in bytes. The example assumes TESTFILE is a file containing data. If the file is open, FileLen returns the size before it was opened; use LOF for open files. ```vb Dim MySize MySize = FileLen("TESTFILE") ' Returns file length (bytes). ``` -------------------------------- ### Initialize Source: https://docs.twinbasic.com/tB/Packages/CEF/CefBrowser Launches the browser helper process explicitly. Only needed when CreateInitialized is False; otherwise the helper starts automatically on the first form-layout pass. ```APIDOC ## Initialize ### Description Launches the browser helper process explicitly. Only needed when **CreateInitialized** is **False**; otherwise the helper starts automatically on the first form-layout pass. A second call after the helper is already running is a no-op. ### Syntax _object_.**Initialize** ``` -------------------------------- ### Install a configured service Source: https://docs.twinbasic.com/tB/Packages/WinServicesLib/Services Retrieves a previously configured service by name and triggers its installation. Requires the application to be run as an administrator. ```twinBASIC Private Sub btnInstallA_Click() If App.IsInIDE() Then Err.Raise 5, , "Run the compiled EXE as administrator." Services.GetConfiguredService("MyServiceA").Install End Sub ``` -------------------------------- ### Define PenColor property with Property Let and Property Get Source: https://docs.twinbasic.com/tB/Core/Property Defines a PenColor property using Property Let to accept a color name string and store a numeric code, and Property Get to return the color name from the stored code. The example includes a module-level variable CurrentColor and constants for color values. Calling code demonstrates how to set and get the property. ```twinBASIC Dim CurrentColor As Integer Const BLACK = 0, RED = 1, GREEN = 2, BLUE = 3 ' Set the pen color property for a Drawing package. ' The module-level variable CurrentColor is set to ' a numeric value that identifies the color used for drawing. Property Let PenColor(ColorName As String) Select Case ColorName ' Check color name string. Case "Red" CurrentColor = RED ' Assign value for Red. Case "Green" CurrentColor = GREEN ' Assign value for Green. Case "Blue" CurrentColor = BLUE ' Assign value for Blue. Case Else CurrentColor = BLACK ' Assign default value. End Select End Property ' Returns the current color of the pen as a string. Property Get PenColor() As String Select Case CurrentColor Case RED: PenColor = "Red" Case GREEN: PenColor = "Green" Case BLUE: PenColor = "Blue" End Select End Property ' Calling code: PenColor = "Red" ' Calls Property Let. ColorName = PenColor ' Calls Property Get. ``` -------------------------------- ### Initialize and interact with TreeView Source: https://docs.twinbasic.com/tB/Packages/WinNativeCommonCtls/TreeView Demonstrates setting up a TreeView with an ImageList, adding nodes, and handling the NodeClick event. ```vb Private Sub Form_Load() Set TreeView1.ImageList = ImageList1 TreeView1.Style = tvwTreelinesPlusMinusPictureText Dim root As Node Set root = TreeView1.Nodes.Add(, , "root", "My Computer", "computer") TreeView1.Nodes.Add root, tvwChild, "c", "C: drive", "disk" TreeView1.Nodes.Add root, tvwChild, "d", "D: drive", "disk" root.Expanded = True End Sub Private Sub TreeView1_NodeClick(ByVal Node As Node) Debug.Print "Clicked: " & Node.FullPath End Sub ``` -------------------------------- ### Name Property Source: https://docs.twinbasic.com/tB/Packages/WinServicesLib/ServiceManager Gets or sets the service's name in the SCM database. Must be unique across all services installed on the system and is used by services.msc and sc.exe. ```APIDOC ## Name Property ### Description Gets or sets the service's name in the SCM database. The name is used by services.msc and sc.exe, stored at HKLM\SYSTEM\CurrentControlSet\Services\ when Install is called, and is the ServiceName argument for Services.LaunchService, Services.ControlService, and Services.QueryStateOfService. Must be unique across all services installed on the system. ### Syntax Get: _manager_.**Name** Let: _manager_.**Name** = _value_ ### Parameters _value_ - A String identifying the service in the SCM database. Must be unique across all services installed on the system. ### Remarks Name must be assigned before calling Install or Uninstall. It is also the key the dispatcher uses to match an incoming SCM service-thread invocation to its ServiceManager configuration; every configured manager must have a unique Name within the EXE. ### Example ``` With Services.ConfigureNew .Name = "MyBackgroundSvc" ' ...other configuration End With ``` ``` -------------------------------- ### CurrentProcedureName usage in a Sub Source: https://docs.twinbasic.com/tB/Modules/Compilation/CurrentProcedureName Use CurrentProcedureName to get the name of the current procedure at compile time. The example prints 'DoWork' when called inside the DoWork Sub. ```vb Public Sub DoWork() Debug.Print CurrentProcedureName() ' Prints "DoWork" End Sub ``` -------------------------------- ### DeleteSetting Example: Save and Delete Registry Settings Source: https://docs.twinbasic.com/tB/Modules/Interaction/DeleteSetting Shows how to use SaveSetting to create registry entries and then DeleteSetting to remove an entire section. The example omits the key argument, so the whole 'Startup' section is deleted, including all its keys. ```twinBASIC ' Place some settings in the registry. SaveSetting appname := "MyApp", section := "Startup", _ key := "Top", setting := 75 SaveSetting "MyApp", "Startup", "Left", 50 ' Remove section and all its settings from registry. DeleteSetting "MyApp", "Startup" ```