Dec 19, 2001 #1 xartas Programmer Aug 20, 2001 26 ES Hi, i'm writing a program that needs the local machine name of the machine where it's running. Which function should i use to read this parameter? Best regards.
Hi, i'm writing a program that needs the local machine name of the machine where it's running. Which function should i use to read this parameter? Best regards.
Dec 19, 2001 #2 sggaunt Programmer Jul 4, 2001 8,620 GB Try Wnetgetconnection, Wnetgetuser. or one of the others in this group. The local name is held in the lplocalname property of the netresource structure. Delphi Help will jump to the relevent API stuff if you do an F1 on wnetgetuser Steve Upvote 0 Downvote
Try Wnetgetconnection, Wnetgetuser. or one of the others in this group. The local name is held in the lplocalname property of the netresource structure. Delphi Help will jump to the relevent API stuff if you do an F1 on wnetgetuser Steve
Dec 20, 2001 #3 BobbaFet Programmer Feb 25, 2001 903 NL You can also just look it up in the registery. Everyone has a right to my opinion. E-mail me at cwcon@programmer.net http://cwcon.50megs.com/Be a nice guy 'n press that little ol' button VVV---(this one) for me ;-) Upvote 0 Downvote
You can also just look it up in the registery. Everyone has a right to my opinion. E-mail me at cwcon@programmer.net http://cwcon.50megs.com/Be a nice guy 'n press that little ol' button VVV---(this one) for me ;-)
Dec 21, 2001 #4 NeilP Programmer Feb 11, 2001 12 GB Try the API function GetComputerName Upvote 0 Downvote
Jan 24, 2002 2 #5 paulbenn Programmer Jan 24, 2002 108 GB You first need to Create 2 Variables NameSize : DWORD; ComputerName : PChar; Then use this code to read the name and place it in a label ComputerName := #0; NameSize := MAX_COMPUTERNAME_LENGTH + 1; try GetMem(ComputerName, NameSize); Windows.GetComputerName(ComputerName, NameSize); Label1.Caption:= StrPas(ComputerName); finally FreeMem(ComputerName); end; You could create another Variable (String this time) and then assign the value to that instead of the Label Caption. Kind Regards, Paul Benn **** Never Giveup, keep trying, the answer is out there!!! **** Upvote 0 Downvote
You first need to Create 2 Variables NameSize : DWORD; ComputerName : PChar; Then use this code to read the name and place it in a label ComputerName := #0; NameSize := MAX_COMPUTERNAME_LENGTH + 1; try GetMem(ComputerName, NameSize); Windows.GetComputerName(ComputerName, NameSize); Label1.Caption:= StrPas(ComputerName); finally FreeMem(ComputerName); end; You could create another Variable (String this time) and then assign the value to that instead of the Label Caption. Kind Regards, Paul Benn **** Never Giveup, keep trying, the answer is out there!!! ****