Re: who build this program?



Assuming you use PlatformBuilder 6, a plug in for VS2005 ....

see inline.

"ydlu" <yudiannlu@xxxxxxxxx> wrote in message
news:1c637785-a517-4958-964c-eb4866b4a75b@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
In our group, six developer, so our project had a lot of "intern"
build, to we can test it, how can we pass the "username" - environment
variable, into program and show this username.

In Command prompt:
set username
USERNAME=MYNAME
Ok, this is a check that your USERNAME is MYNAME.

- then set on the project property
UNAME=$(USERNAME)
Yes, you pass the -DUNAME=$(USERNAME) to the compiler when you add this line
to the "Preprocessor Definitions" of the C++ properties.

- define in C program

#define username(x) L#x
No. This does not work. Use this instead:
#define WSTR(s) L#s
#define username(u) WSTR(u)

You need the second macro definition.


void printUserName()
{
_tprintf(TEXT("%s\n"), username(UNAME));
}
Well, if you plan to use the TEXT macro, even if Windows CE uses always
Unicode strings, you should consider to define username this way:
#define TSTR(s) _T(#s)
#define username(u) TSTR(u)

But I would replace _tprintf by wprintf.


Helge


.



Relevant Pages

  • Re: Active Directory and Dotnet....
    ... You didn't mention what environment you were running in, ... > I am trying to access the users of active directory. ... > username and password it doesn't give any user. ... > If i dont pass username and password and check for the ...
    (microsoft.public.dotnet.security)
  • Re: Who is sufficiently brave to post a follow-up?
    ... (CBA to go to read that.) ... I notice his username is now 'A. ... He has not posted anything which is in violation of the Microsoft ... I don't even use words like 'environment'. ...
    (microsoft.public.windowsxp.general)
  • Re: Home Folder
    ... %username% works because "username" is an environment ... While givenName and sn are the names of attributes in Active ... they are not environment variables. ... If John Smith logs in as jsmith, ...
    (microsoft.public.windows.server.active_directory)
  • Re: Environ()
    ... there's a button labelled "Environment ... Computername. ... >Doug Steele, Microsoft Access MVP ... that "USERNAME" ...
    (microsoft.public.access.formscoding)
  • Re: Erron on Web.config identity impersonate
    ... My Web.config file in my C# .Net web application has the ... However, in some cases the web.config and our environment didn't match correctly, ... How do I config the Web.config so the error message won't show the Username and Password stuff? ...
    (microsoft.public.dotnet.languages.csharp)