Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: [Tokyo] GetComputerName



Permlink Replies: 1 - Last Post: Oct 19, 2017 2:03 PM Last Post By: Remy Lebeau (Te...
Gabriel GRIPARI

Posts: 24
Registered: 3/26/09
[Tokyo] GetComputerName
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 19, 2017 12:48 PM
Bonjour,

I'm working with Embarcadero C++ Builder Enterprise Tokyo 10.2.1

With Berlin, this syntax is correct :

#include "System.SysUtils.hpp"
TEdit1->Text=GetEnvironmentVariable(COMPUTERNAME) ;

With Tokyo, the same syntax, returns an error:

#include "System.SysUtils.hpp"
TEdit1->Text=GetEnvironmentVariable(COMPUTERNAME) ;

===> use of the 'COMPUTERNAME' identifier not declared

Any solution ?

Best regards

Gabriel
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: [Tokyo] GetComputerName
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 19, 2017 2:03 PM   in response to: Gabriel GRIPARI in response to: Gabriel GRIPARI
Gabriel GRIPARI wrote:

With Berlin, this syntax is correct :

#include "System.SysUtils.hpp"
TEdit1->Text=GetEnvironmentVariable(COMPUTERNAME) ;

With Tokyo, the same syntax, returns an error:

#include "System.SysUtils.hpp"
TEdit1->Text=GetEnvironmentVariable(COMPUTERNAME) ;

===> use of the 'COMPUTERNAME' identifier not declared

Obviously, in Tokyo, the COMPUTERNAME constant is either no longer
defined, or has been moved to another header.

Did you try asking Berlin where COMPUTERNAME is actually defined?
Maybe there is a 3rd party package in your Berlin project that is
defining COMPUTERNAME, and it is not in your Tokyo project?

Is there a reason why you are relying on an unknown and undocumented
constant to begin with, instead of a string literal?

TEdit1->Text = GetEnvironmentVariable(L"COMPUTERNAME");


Or better, the Win32 API GetComputerName() function?

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02