Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Computer Name in AllCaps instead of preserving case
#1
Hi Gintaras,
Whether I use:

str Computer
GetUserInfo &Computer 1 ;;Computer
out Computer

GetUserComputer 0 Computer
out Computer

the computer name is returned in All Caps e.g. COMPUTER-LASTNAME wherease it is actually "Computer-Lastname" as listed in Control Panel --> System --> Computer Name.

Is there anyway to get this to retain the exact capitalization. This is causing a db table lookup function to fail.
Thanks,
S
#2
Macro Macro1841
Code:
Copy      Help
BSTR b.alloc(1000)
int n=b.len

;these get all caps, same as GetComputerName that is used by QM functions
;if(!GetComputerNameExW(ComputerNameNetBIOS b &n)) end "failed"
;if(!GetComputerNameExW(ComputerNamePhysicalNetBIOS b &n)) end "failed"

;these get correct case
;if(!GetComputerNameExW(ComputerNameDnsHostname b &n)) end "failed"
;if(!GetComputerNameExW(ComputerNameDnsFullyQualified b &n)) end "failed" ;;this can get HostName.DomainName
if(!GetComputerNameExW(ComputerNamePhysicalDnsHostname b &n)) end "failed"
;if(!GetComputerNameExW(ComputerNamePhysicalDnsFullyQualified b &n)) end "failed"

str s=b
out s

;Don't know which is the best. I would choose the non-commented. But look in GetComputerNameEx documentation in MSDN.
;With xxxPhysicalxxx always get local computer name. About others MSDN says:
;"If the local computer is a node in a cluster, gets the DNS host name of the cluster virtual server."
#3
Thanks so much! ! Will test this evening.
S
#4
worked as written and commented!
Thanks So Much!
S


Forum Jump:


Users browsing this thread: 1 Guest(s)