In Windows NT you can use %USERNAME% and %COMPUTERNAME% in scripts, extracting this info off of PCs. I need to do the same thing in my simple C++ program. Basically, I need to do this:
char *thisComputer = %COMPUTERNAME%;
char *thisUser = %USERNAME%;
YES, I *know* this isn't correct syntax, - I'm showing this to illustrate what I need my end result to do, not the actual coding itself. Does anyone know if this is possible? Or can point me in the right direction? I've looked through a whole bunch of header files, specifically lmwksta.h, lmbrowsr.h, and others, but all the lm*.h header files require you to use the NETCONS.H file, which I don't have and Microsoft quit supporting/selling quite a while back. Fordy helped me out with the USERNAME part, using lpUser, and that works great, but the lpSystem function isn't giving me the ComputerName as it should. It returns back garbage. Thanks for ANY help guys!