Results 1 to 6 of 6

Thread: two questions *Resolved*

  1. #1

    Thread Starter
    Registered User Virus00110's Avatar
    Join Date
    Jul 2002
    Location
    Williamsport, PA
    Posts
    290

    Question 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.

  2. #2
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    VB Code:
    1. 'example by Donavon Kuhn ([email protected])
    2. Private Const MAX_COMPUTERNAME_LENGTH As Long = 31
    3. Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    4. Private Sub Form_Load()
    5.     Dim dwLen As Long
    6.     Dim strString As String
    7.     'Create a buffer
    8.     dwLen = MAX_COMPUTERNAME_LENGTH + 1
    9.     strString = String(dwLen, "X")
    10.     'Get the computer name
    11.     GetComputerName strString, dwLen
    12.     'get only the actual data
    13.     strString = Left(strString, dwLen)
    14.     'Show the computer name
    15.     MsgBox strString
    16. End Sub

    I'm not sure about the second question.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  3. #3

    Thread Starter
    Registered User Virus00110's Avatar
    Join Date
    Jul 2002
    Location
    Williamsport, PA
    Posts
    290
    thanx for ? one. anyone any info on ? 2?????

  4. #4
    New Member
    Join Date
    Jan 2003
    Location
    South Florida
    Posts
    14

    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.
    Thank you.

  5. #5
    New Member
    Join Date
    Jan 2003
    Location
    South Florida
    Posts
    14

    Also...

    The docs are for Windows NT not 2000 but if you search for srvany.exe here you'll find plenty.

    Jim.
    Thank you.

  6. #6
    New Member
    Join Date
    Nov 2003
    Posts
    12
    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
  •  



Click Here to Expand Forum to Full Width