Click here to Skip to main content
15,847,549 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CButton GetState , how to read the press and hold state of a button? Pin
Hamid_RT15-Jan-10 21:26
Hamid_RT15-Jan-10 21:26 
GeneralRe: CButton GetState , how to read the press and hold state of a button? Pin
timbk16-Jan-10 12:18
timbk16-Jan-10 12:18 
AnswerRe: CButton GetState , how to read the press and hold state of a button? Pin
Rozis16-Jan-10 11:17
Rozis16-Jan-10 11:17 
Questionsystem call too small Pin
2buck5615-Jan-10 11:36
2buck5615-Jan-10 11:36 
AnswerRe: system call too small Pin
CPallini15-Jan-10 11:44
mveCPallini15-Jan-10 11:44 
GeneralRe: system call too small Pin
2buck5615-Jan-10 12:36
2buck5615-Jan-10 12:36 
GeneralRe: system call too small Pin
LunaticFringe15-Jan-10 12:44
LunaticFringe15-Jan-10 12:44 
GeneralRe: system call too small Pin
2buck5615-Jan-10 13:26
2buck5615-Jan-10 13:26 
OK, do you have any suggestion as to how I find where the message is coming from? I have a dialog based form that has nothing on it except a list box for the messages and a button to find my HID device when I click the button. So I put this code as the first 2 lines in my OnBnClicked function:
SetLastError(0);
DisplayLastError((CString)"Button Clicked Function: ");
This is what the result is:
Button Clicked Function: The data area passed to a system call is too small

Is it possible the call to DisplayLastError is causing this due to the CString cast? Here is that code:

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,
		0,
		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);
}
I have no function calls in my BOOL CHIDTest2008Dlg::OnInitDialog(). And the debug window shows no errors when I run the application.

This same code runs without the error messages when compiled with VC6++.
GeneralRe: system call too small Pin
Garth J Lancaster15-Jan-10 13:49
professionalGarth J Lancaster15-Jan-10 13:49 
GeneralRe: system call too small Pin
LunaticFringe15-Jan-10 14:01
LunaticFringe15-Jan-10 14:01 
GeneralRe: system call too small Pin
2buck5615-Jan-10 14:51
2buck5615-Jan-10 14:51 
GeneralRe: system call too small [modified] Pin
LunaticFringe15-Jan-10 15:31
LunaticFringe15-Jan-10 15:31 
GeneralRe: system call too small Pin
2buck5615-Jan-10 16:02
2buck5615-Jan-10 16:02 
GeneralRe: system call too small Pin
CPallini15-Jan-10 23:02
mveCPallini15-Jan-10 23:02 
GeneralRe: system call too small Pin
CPallini15-Jan-10 23:11
mveCPallini15-Jan-10 23:11 
GeneralRe: system call too small Pin
Garth J Lancaster15-Jan-10 23:41
professionalGarth J Lancaster15-Jan-10 23:41 
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 
QuestionDefault path to Desktop with vista Pin
dbell0715-Jan-10 10:52
dbell0715-Jan-10 10:52 

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.