Click here to Skip to main content
16,011,754 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how can i handle file commands to read and write xml files Pin
Tomasz Sowinski22-Jun-01 1:50
Tomasz Sowinski22-Jun-01 1:50 
QuestionHow can I send a key combination (for example Ctrl+F2) to any window? Pin
20-Jun-01 20:03
suss20-Jun-01 20:03 
AnswerRe: How can I send a key combination (for example Ctrl+F2) to any window? Pin
Amit Jain21-Jun-01 4:35
Amit Jain21-Jun-01 4:35 
GeneralPrint preview Pin
20-Jun-01 18:38
suss20-Jun-01 18:38 
GeneralRe: Print preview Pin
Christian Graus20-Jun-01 18:54
protectorChristian Graus20-Jun-01 18:54 
GeneralRe: Print preview Pin
20-Jun-01 20:32
suss20-Jun-01 20:32 
GeneralRe: Print preview Pin
Christian Graus20-Jun-01 22:26
protectorChristian Graus20-Jun-01 22:26 
General'GetUserName' failure Pin
Todd Shipp20-Jun-01 17:28
Todd Shipp20-Jun-01 17:28 
I am new to C++ and am self-teaching myself. I am trying to build a console app to perform several operations. One is the get the username. I keep getting an ERROR 122 (ERROR_INSUFFICIENT_BUFFER).

Can anyone look at my code and give assistance?

Here is my code:
================

char lpBuffer[256] = {0};
unsigned long nSize;
long lRetCode;
.
.
.
int GetUsrName()
{
lRetCode = GetUserName(lpBuffer,&nSize);
lRetCode = GetLastError();
if (lRetCode != ERROR_SUCCESS) {
LastError();
}
return (0);
}

Confused | :confused:
GeneralRe: 'GetUserName' failure Pin
Christian Graus20-Jun-01 18:57
protectorChristian Graus20-Jun-01 18:57 
GeneralRe: 'GetUserName' failure Pin
markkuk20-Jun-01 19:31
markkuk20-Jun-01 19:31 
GeneralRe: 'GetUserName' failure Pin
Orbital^20-Jun-01 22:39
Orbital^20-Jun-01 22:39 
GeneralRe: 'GetUserName' failure Pin
Todd Shipp21-Jun-01 4:23
Todd Shipp21-Jun-01 4:23 
GeneralRe: 'GetUserName' failure Pin
21-Jun-01 5:29
suss21-Jun-01 5:29 
QuestionPanel in C++?? Pin
Farah Mansor20-Jun-01 16:45
Farah Mansor20-Jun-01 16:45 
AnswerRe: Panel in C++?? Pin
20-Jun-01 17:01
suss20-Jun-01 17:01 
GeneralSimple CMainFrame App problem Pin
John Treubig20-Jun-01 16:42
John Treubig20-Jun-01 16:42 
GeneralWindows explorer command line Pin
Avneesh Bhatnagar20-Jun-01 16:18
Avneesh Bhatnagar20-Jun-01 16:18 
GeneralRe: Windows explorer command line Pin
20-Jun-01 16:54
suss20-Jun-01 16:54 
GeneralRe: Windows explorer command line Pin
Avneesh Bhatnagar20-Jun-01 17:25
Avneesh Bhatnagar20-Jun-01 17:25 
GeneralThreads and DLLs (Advanced Issues) Pin
Joe Hastings20-Jun-01 15:32
Joe Hastings20-Jun-01 15:32 
GeneralRe: Threads and DLLs (Advanced Issues) Pin
20-Jun-01 15:52
suss20-Jun-01 15:52 
GeneralRe: Threads and DLLs (Advanced Issues) Pin
Stephen Kellett21-Jun-01 5:07
Stephen Kellett21-Jun-01 5:07 
GeneralRe: Threads and DLLs (Advanced Issues) Pin
Joe Hastings22-Jun-01 3:15
Joe Hastings22-Jun-01 3:15 
Generalstandard search algorithm Pin
Nick Blumhardt20-Jun-01 15:12
Nick Blumhardt20-Jun-01 15:12 
GeneralRe: standard search algorithm Pin
20-Jun-01 15:17
suss20-Jun-01 15:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.