Click here to Skip to main content
15,846,826 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: system call too small Pin
CPallini15-Jan-10 23:43
mveCPallini15-Jan-10 23:43 
GeneralRe: system call too small Pin
Garth J Lancaster15-Jan-10 23:59
professionalGarth J Lancaster15-Jan-10 23:59 
GeneralRe: system call too small Pin
CPallini16-Jan-10 0:10
mveCPallini16-Jan-10 0:10 
GeneralRe: system call too small Pin
Bram van Kampen17-Jan-10 7:18
Bram van Kampen17-Jan-10 7:18 
AnswerRe: system call too small Pin
Richard MacCutchan16-Jan-10 0:55
mveRichard MacCutchan16-Jan-10 0:55 
AnswerRe: system call too small Pin
David Crow16-Jan-10 6:06
David Crow16-Jan-10 6:06 
GeneralRe: system call too small Pin
CPallini16-Jan-10 8:57
mveCPallini16-Jan-10 8:57 
GeneralRe: system call too small Pin
2buck5616-Jan-10 12:01
2buck5616-Jan-10 12:01 
Richard this is the code for DisplayLastError:
void CHIDTest2008Dlg::DisplayLastError(CString Operation)
{
//Display a message and the last error in the log List Box.
	LPVOID lpMsgBuf;
	USHORT Index = 0;
	CString	strLastError;
	FormatMessage( 
		FORMAT_MESSAGE_ALLOCATE_BUFFER | 
		FORMAT_MESSAGE_FROM_SYSTEM | 
		FORMAT_MESSAGE_IGNORE_INSERTS,
		NULL,
		GetLastError(),
		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
		(LPTSTR) &lpMsgBuf,
		4096,
		NULL 
	);

	//Display the last error.
	strLastError = Operation + (LPCTSTR)lpMsgBuf; 

	//Trim CR/LF from the error message.
	strLastError.TrimRight(); 
	Index = m_ResultsList.InsertString(-1, strLastError);
	ScrollToBottomOfListBox(Index);
	LocalFree(lpMsgBuf);
And I believe you are correct in saying that the CString cast is causing the error. If I call GetLastError immediately after entering my OnBnClick funtion I get the error. At that point no API call has been made (other than the ones the system is doing). Also, by turning off unicode and going to MBCS, all the error messages disappeared. That points to the CString cast.

Ian, the code you show is the way I am doing it now. Since none of my API calls are failing I am not getting any error messages.
QuestionDefault path to Desktop with vista Pin
dbell0715-Jan-10 10:52
dbell0715-Jan-10 10:52 
AnswerRe: Default path to Desktop with vista Pin
CoderGirl4215-Jan-10 11:18
CoderGirl4215-Jan-10 11:18 
GeneralRe: Default path to Desktop with vista Pin
David Crow15-Jan-10 11:25
David Crow15-Jan-10 11:25 
GeneralRe: Default path to Desktop with vista Pin
dbell0715-Jan-10 11:46
dbell0715-Jan-10 11:46 
GeneralRe: Default path to Desktop with vista Pin
dbell0715-Jan-10 11:49
dbell0715-Jan-10 11:49 
GeneralRe: Default path to Desktop with vista Pin
Rozis16-Jan-10 11:28
Rozis16-Jan-10 11:28 
GeneralRe: Default path to Desktop with vista Pin
Spawn@Melmac18-Jan-10 1:35
Spawn@Melmac18-Jan-10 1:35 
QuestionShowing and Closing Dialogs in C++ Pin
NightBeforeChirstmas15-Jan-10 10:29
NightBeforeChirstmas15-Jan-10 10:29 
AnswerRe: Showing and Closing Dialogs in C++ Pin
Maximilien15-Jan-10 10:31
Maximilien15-Jan-10 10:31 
AnswerRe: Showing and Closing Dialogs in C++ Pin
David Crow15-Jan-10 10:48
David Crow15-Jan-10 10:48 
AnswerRe: Showing and Closing Dialogs in C++ Pin
Bram van Kampen17-Jan-10 7:35
Bram van Kampen17-Jan-10 7:35 
QuestionRetrieving Windows version, then enumerating process list Pin
int_8015-Jan-10 6:49
int_8015-Jan-10 6:49 
QuestionRe: Retrieving Windows version, then enumerating process list Pin
David Crow15-Jan-10 8:53
David Crow15-Jan-10 8:53 
AnswerRe: Retrieving Windows version, then enumerating process list Pin
CPallini15-Jan-10 12:06
mveCPallini15-Jan-10 12:06 
Questionhow to draw a graph on 2 axes in a window Pin
N Vamshi Krishna15-Jan-10 6:39
N Vamshi Krishna15-Jan-10 6:39 
QuestionRe: how to draw a graph on 2 axes in a window Pin
CPallini15-Jan-10 6:51
mveCPallini15-Jan-10 6:51 
AnswerRe: how to draw a graph on 2 axes in a window Pin
N Vamshi Krishna15-Jan-10 7:10
N Vamshi Krishna15-Jan-10 7:10 

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.