Solved

Determine current machine app is on

Posted on 2003-11-18
2
190 Views
Last Modified: 2010-05-01
can a vb6 application work out what machine it is currently running on

ie can it query the OS to find a UNC path:

\\MYPC


I am after some code!
thanks



0
Comment
Question by:MrKevorkian
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 250 total points
Comment Utility
If you need the computer name then:

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

Private Sub Form_Load()
    Dim compName As String
    Dim result As Long
   
    compName = String(255, Chr$(0))
    result = GetComputerName(compName, 255)
    If result = 0 Then
        MsgBox "Unable to retrieve Computer Name"
    Else
        compName = Left(compName, InStr(compName, Chr$(0)) - 1)
        MsgBox "Computer Name: " & compName
    End If
End Sub
0
 
LVL 1

Author Comment

by:MrKevorkian
Comment Utility
Perfect.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

762 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

10 Experts available now in Live!

Get 1:1 Help Now