Solved

Changing the computer name under Windows XP...

Posted on 2002-06-17
4
162 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

734 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