🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5784

Using GetUserNameEx()

#5784
From: Jeff
Date: Wed, 29 Jun 2005 17:55
26 lines
1750 bytes
I'm trying to use a Windows API call to get the full name of the person 
logged into the current system. When I compile my code below I get an 
"Unresolved external 'GetUserNameExW' referenced from..." linker error.

Anyone know what I'm doing wrong?

Thanks,
Jeff

//---------------------------------------------------------------------------
#define SECURITY_WIN32 1
#define UNICODE 1

#define MAXBUFF 512
//---------------------------------------------------------------------------
#include <Security.h>
//---------------------------------------------------------------------------

WCHAR   wszDN[MAXBUFF];  //Character buffer for DN Name
ULONG   cchDN = MAXBUFF; //Length of DN Name

if (!GetUserNameEx(NameDisplay, wszDN, &cchDN))
    Application->MessageBox("Error getting user''s full name", "Error", 
MB_OK|MB_ICONERROR);
else
    lbeAddress->Text = static_cast<String>(wszDN); 
Technical Details
Message-ID: <42c2e09e$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!newsfeed.bit.nl!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,bb7477294a9a4681
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Jeff" <Jeff@nospam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Using GetUserNameEx()
Date: Wed, 29 Jun 2005 11:55:37 -0600
Lines: 28
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
NNTP-Posting-Host: 198.68.195.180
Message-ID: <42c2e09e$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1120067742 198.68.195.180 (29 Jun 2005 10:55:42 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!newsfeed.bit.nl!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail