Announcement

Collapse
No announcement yet.

Computer Name

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Computer Name

    Using PBcc 5 - XP & Vista

    How do I get my computer name?

    Print "My Computers Name Is: "; MyComputersName$


    Thanks Again for your assistance, it's always been great.

    Jack

  • #2
    See Host Name in the help file.

    Code:
    Host Name To MyComputersName$
    
    ? MyComputersName$
    Last edited by Scott Slater; 12 Apr 2009, 10:56 AM. Reason: added code example
    Scott Slater
    Summit Computer Networks, Inc.
    www.summitcn.com

    Comment


    • #3
      you can also use the API...

      Code:
      cName As Asciiz * 128
      
      GetComputerName cName, SizeOf(cName)
      
      ? cName
      Scott Slater
      Summit Computer Networks, Inc.
      www.summitcn.com

      Comment


      • #4
        Works perfect, thanks again
        Jack

        Comment


        • #5
          Code:
          Function PBMain() As Long
          
             Local zText As Asciiz * (%MAX_COMPUTERNAME_LENGTH + 1)
          
             GetComputerName zText, SizeOf(zText)
             
             ? zText
          
          End Function
          Paul Squires
          FireFly Visual Designer (for PowerBASIC Windows 10+)
          Version 3 now available.
          http://www.planetsquires.com

          Comment


          • #6
            Rem #INCLUDE "WIN32API.INC"

            %MAX_COMPUTERNAME_LENGTH = 15

            Function PbMain() As Long
            ..
            Rgds, Dave

            Comment

            Working...
            X