Solved

Changing the computer name under Windows XP...

Posted on 2002-06-17
4
152 Views
Last Modified: 2010-05-18
I'm not sure if this even counts as a VB question or not, but what the hoo..

I'm trying to change the computer name from within a simple VB app I've written.  The original plan was to create a .REG registry file to change the ComputerName key, but under Xp, changing that key has no effect.

I'm an old time .batch file geek, and I don't know two halves about VB.. if I could use a batch file to achieve my goal just as easily, I'd be doing that instead of using VB... but a text interface just isn't the same thing as a simple VB form.  :)  So please gear your answer with my incompitence in mind.

If this is not something that can easily be done through VB, I'll call this question a wash and put it under the Win XP section, but I expect that someone somewhere has tried to do this under VB...

Thank you for your help.
0
Comment
Question by:EDStech
  • 2
  • 2
4 Comments
 
LVL 2

Author Comment

by:EDStech
ID: 7084221
Also if it matters...

I'm using Visual Basic 6.
I'm using Windows XP Pro.
These machines are not on a domain.

Thanks.
0
 
LVL 18

Accepted Solution

by:
bobbit31 earned 100 total points
ID: 7084241
you can use SetComputerName api:

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

Private Sub Command1_Click()
    Dim retVal As Long
    retVal = SetComputerName(Text1.Text)
end sub
0
 
LVL 2

Author Comment

by:EDStech
ID: 7084289
Well heck, that was easy.  Perfect!

Thank you.
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7084335
welcome :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Replace Formatted Numbers with text 9 61
VB6 add a minute to the date time value 8 61
Error when passing an argument to a vb6 that contains  '/' 7 31
Advice in Xamarin 21 57
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now