Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than kernel32, prefix the name with the module name and a period.
Declare Function GetComputerName Lib "kernel32" (ByVal lpBuffer As String, ByRef nMax As Integer) As Boolean
User-Defined Types:
None.
Notes:
The GetComputerName function retrieves the NetBIOS name of the local computer. This name is established at system startup, when the system reads it from the registry.
Tips & Tricks:
Make sure to go in to the build properties of your project and check "Allow Unsafe Code". Second version doesn't recquest this.
Sample Code:
using System.Management;
using System.Runtime.InteropServices;
Dim buff As String = Space(255)
Dim max As Integer = 255
Dim rc As Integer
rc = GetComputerName(buff,max)
' Now, max contains the total number of characters written to the buffer
MessageBox.Show( Mid(buff,1,max) )
Alternative Managed API:
System.Environment.MachineName will get you the netbios name.
Retrieves a NetBIOS or DNS name associated with the local computer.
10/13/2016 5:13:00 AM - -80.153.31.232
Retrieves a NetBIOS or DNS name associated with the local computer.
10/13/2016 5:13:00 AM - -80.153.31.232
The Netbios function interprets and executes the specified network control block (NCB). The Netbios function is provided primarily for applications that were written for the NetBIOS interface and need to be ported to Windows. Applications not requiring compatibility with NetBIOS should use other interfaces, such as mailslots, named pipes, RPC, or distributed COM to accomplish tasks similar to those supported by NetBIOS. These other interfaces are more flexible and portable.
5/23/2014 9:41:50 AM - jonr@reedholm.com-71.114.254.154
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).