local machine computer name

This should be fairly simple, at least I think and I'm having a brain fade right now...but can anyone tell me how to get the computername usiong VB of the local machine I'm running the application on?  Not a network UNC...I know how to do that but when I enumerate the drives on my machine and get the UNC's for the mapped drives that works fine but when it hits a local fixed disk I can't get the UNC of the local machine.  

Can anybody help with this?

Thanks
LVL 1
davismAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Erick37Commented:
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long

Private Sub Command1_Click()
    Dim sName As String
    Dim lSize As Long
    sName = String(255, Chr(0))
    lSize = 255
    Call GetComputerName(sName, lSize)
    sName = Left(sName, lSize)
    Debug.Print sName
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
davismAuthor Commented:
I should've known that.  Brain fade on my part.  But Thanks!  Greatly appreciated.
0
PerlChaserCommented:
Thanks for the code!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.