question one how can i get the name of the computer with VB and two how can i make an app run as a service?
thanks in advance
Printable View
question one how can i get the name of the computer with VB and two how can i make an app run as a service?
thanks in advance
VB Code:
'example by Donavon Kuhn ([email protected]) Private Const MAX_COMPUTERNAME_LENGTH As Long = 31 Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long Private Sub Form_Load() Dim dwLen As Long Dim strString As String 'Create a buffer dwLen = MAX_COMPUTERNAME_LENGTH + 1 strString = String(dwLen, "X") 'Get the computer name GetComputerName strString, dwLen 'get only the actual data strString = Left(strString, dwLen) 'Show the computer name MsgBox strString End Sub
I'm not sure about the second question.
thanx for ? one. anyone any info on ? 2?????
I've created formless apps that sync data between two different software packages. I have utilized srvany.exe to set them up as services and have had little to no problems. Check out
http://www.href.com/pub/Helpful/SrvAny/Srvany.wri
for some documentation. I believe there are some API calls you can make from w/in your app to register it as a service but I've no experience with them.
Srvany.exe worked well for my needs. Hope this helps.
The docs are for Windows NT not 2000 but if you search for srvany.exe here you'll find plenty.
Jim.
for computer name you can use winsock. Insert a winsock control and put this code in:
Text1.Text = Winsock1.LocalHostName