By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,333 Members | 1,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,333 IT Pros & Developers. It's quick & easy.

How do I change the computer name

P: n/a
Hi, I tried to use

Private Declare Function SetComputerName Lib "kernel32" Alias
"SetComputerNameA" (ByVal lpComputerName As String) As Long

SetComputerName(newname)

newname is the name I want to change to.
But after I reboot the windows 2000 prof. the computer name remained
the same.

Any ideas?

Thanks!

Greg

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"greg chu" <gr******@wendys.com> schrieb:
Private Declare Function SetComputerName Lib "kernel32" Alias
"SetComputerNameA" (ByVal lpComputerName As String) As Long

SetComputerName(newname)

newname is the name I want to change to.
But after I reboot the windows 2000 prof. the computer name remained
the same.


Use this declare instead:

\\\
Private Declare Auto Function SetComputerName Lib "kernel32.dll" ( _
ByVal lpComputerName As String _
) As Boolean
..
..
..
Dim Success As Boolean = SetComputerName("Bla")
///

First, check the return value. If it is 'False', then check the computer
name (see documentation for information about valid computer names).
Second, note that the name change will take place after a restart.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.