|
-
Nov 20th, 2003, 11:08 AM
#1
Thread Starter
Registered User
two questions *Resolved*
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
Last edited by Virus00110; Nov 20th, 2003 at 01:39 PM.
-
Nov 20th, 2003, 11:10 AM
#2
Frenzied Member
VB Code:
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.
-
Nov 20th, 2003, 11:20 AM
#3
Thread Starter
Registered User
thanx for ? one. anyone any info on ? 2?????
-
Nov 20th, 2003, 12:21 PM
#4
New Member
c:\winnt\system32\tools\srvany.exe
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.
-
Nov 20th, 2003, 12:29 PM
#5
New Member
Also...
The docs are for Windows NT not 2000 but if you search for srvany.exe here you'll find plenty.
Jim.
-
Nov 20th, 2003, 01:44 PM
#6
New Member
for computer name you can use winsock. Insert a winsock control and put this code in:
Text1.Text = Winsock1.LocalHostName
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|