how i get computer name with vb 6?
any help will be appreciated
Private Declare Function GetComputerName Lib "kernel32.dll" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long '------------------------------ 'it is also in the registry at 'HKLM \ System \ CurrentControlSet \ Control \ ComputerName \ ComputerName '--------------------------- 'Use the GetComputerName API Function . Private Sub Form_Load() Dim computer_name As String Dim length As Long computer_name = Space$(256) length = Len(computer_name) GetComputerName computer_name, length computer_name = Left$(computer_name, length) lblComputerName.Caption = "[" & computer_name & "]" End Sub
Requires a label named 'lblComputerName' to be on the form.
I found this here http://www.garybeene.com/code/visual%20basic250.htm
go to Components then add Microsoft Winsock Control. then use the code below....
lblHost.Caption = "Hostname: " & sock1.LocalHostName 'where lblHost is a label, sock1 is a winsock control 'you can also get the local Ip by .LocalIp property
hope this helps.
use this following code :
Private Const MAX_COMPUTERNAME_LENGTH As Long = 31 Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long Private Sub GetCompName() Dim dwLen As Long Dim strString As String 'Create a buffer dwLen = MAX_COMPUTERNAME_LENGTH + 1 strString = String(dwLen, "X") 'Get the computer name GetComputerName strString, dwLen 'get only the actual data strString = Left(strString, dwLen) 'Show the computer name MsgBox "WELCOME " & strString End Sub Private Sub Form_Load() GetCompName End Sub
thanks for the code all. its worked :)
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"
Here is the sample output that I ...
Hello All ...
Iam Getting An Error With try to excecute the stored procedure .
I have Have Sql database , the stored procedure like so :
USE [MPRS] GO /****** Object: StoredProcedure [dbo].[Search_Licenses_By_Number] Script Date: 26-Nov-16 8:06:52 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE ...
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...