QuickOPC User's Guide and Reference
_ComputerBrowserDialog Interface
Members  Example 



OpcLabs.BaseLibForms Assembly > OpcLabs.BaseLib.Forms.Browsing.Specialized.ComTypes Namespace : _ComputerBrowserDialog Interface
Exposes OpcLabs.BaseLib.Forms.Browsing.Specialized.ComputerBrowserDialog to COM clients.
Syntax
'Declaration
 
<CLSCompliantAttribute(False)>
<ComVisibleAttribute(True)>
<GuidAttribute("44E3A85F-78F7-42E7-B014-3BA014D94A8E")>
<InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)>
Public Interface _ComputerBrowserDialog 
'Usage
 
Dim instance As _ComputerBrowserDialog
[CLSCompliant(false)]
[ComVisible(true)]
[Guid("44E3A85F-78F7-42E7-B014-3BA014D94A8E")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface _ComputerBrowserDialog 
[CLSCompliant(false)]
[ComVisible(true)]
[Guid("44E3A85F-78F7-42E7-B014-3BA014D94A8E")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface class _ComputerBrowserDialog 
Example

COM

// This example shows how to let the user browse for computers on the network.

#include "stdafx.h"    // Includes "QuickOpc.h", and other commonly used files
#include "ShowDialog.h"

namespace _ComputerBrowserDialog
{
    void ShowDialog::Main()
    {
        // Initialize the COM library
        CoInitializeEx(NULL, COINIT_MULTITHREADED);
        {
            // 
            _ComputerBrowserDialogPtr DialogPtr(__uuidof(ComputerBrowserDialog));

            // 
            DialogResult dialogResult = DialogPtr->ShowDialog(NULL);
            _tprintf(_T("%d\n"), dialogResult);
            
            if (dialogResult == 1/*OK*/)
            {
                // Display results
                _tprintf(_T("%s\n"), (LPCTSTR)CW2CT(DialogPtr->SelectedName));
            }
        }
         // Release all interface pointers BEFORE calling CoUninitialize()
        CoUninitialize();
    }
}
// This example shows how to let the user browse for computers on the network.

class procedure ShowDialog.Main;
var
  Dialog: ComputerBrowserDialog;
begin
  // Instantiate the dialog object
  Dialog := CoComputerBrowserDialog.Create;

  Dialog.ShowDialog(nil);
  // IMPROVE: check the dialog result

  WriteLn(Dialog.SelectedName);
end;
// This example shows how to let the user browse for computers on the network.

class procedure ShowDialog.Main;
var
  ComputerBrowserDialog: OpcLabs_BaseLibForms_TLB._ComputerBrowserDialog;
  DialogResult: System_Windows_Forms_TLB.DialogResult;
begin
  // Instantiate the dialog object
  ComputerBrowserDialog := CoComputerBrowserDialog.Create;

  DialogResult := ComputerBrowserDialog.ShowDialog(nil);
  WriteLn(DialogResult);

  if DialogResult <> DialogResult_OK then
    Exit;

  // Display results
  WriteLn(ComputerBrowserDialog.SelectedName);
end;
// This example shows how to let the user browse for computers on the network.

$Dialog = new COM("OpcLabs.BaseLib.Forms.Browsing.Specialized.ComputerBrowserDialog");
printf("%d\n", $Dialog->ShowDialog);

// Display results
printf("%s\n", $Dialog->SelectedName);
# This example shows how to let the user browse for computers on the network.

# The Python for Windows (pywin32) extensions package is needed. Install it using "pip install pypiwin32".
# CAUTION: We now recommend using Python.NET package instead. Full set of examples with Python.NET is available!
import win32com.client

dialog = win32com.client.Dispatch('OpcLabs.BaseLib.Forms.Browsing.ComputerBrowserDialog') 
print(dialog.ShowDialog())

# Display results
print(dialog.SelectedName)
Rem This example shows how to let the user browse for computers on the network.

Private Sub ShowDialog_Main_Command_Click()
    OutputText = ""

    Dim Dialog As New ComputerBrowserDialog
    Dim DialogResult
    DialogResult = Dialog.ShowDialog
    
    OutputText = OutputText & DialogResult & vbCrLf
    If DialogResult <> 1 Then   ' OK
        Exit Sub
    End If
    
    ' Display results
    OutputText = OutputText & Dialog.SelectedName & vbCrLf
End Sub
Rem This example shows how to let the user browse for computers on the network.

Option Explicit

Const DialogResult_OK = 1

Dim Dialog: Set Dialog = CreateObject("OpcLabs.BaseLib.Forms.Browsing.Specialized.ComputerBrowserDialog")
Dim dialogResult: dialogResult = Dialog.ShowDialog
WScript.Echo dialogResult

If dialogResult <> DialogResult_OK Then
    WScript.Quit
End If

' Display results
WScript.Echo Dialog.SelectedName
Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also