Click here to Skip to main content
15,889,909 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 20:26
Hamid_RT15-Jan-10 20:26 
GeneralRe: CButton GetState , how to read the press and hold state of a button? Pin
timbk16-Jan-10 11:18
timbk16-Jan-10 11:18 
AnswerRe: CButton GetState , how to read the press and hold state of a button? Pin
Rozis16-Jan-10 10:17
Rozis16-Jan-10 10:17 
Questionsystem call too small Pin
2buck5615-Jan-10 10:36
2buck5615-Jan-10 10:36 
AnswerRe: system call too small Pin
CPallini15-Jan-10 10:44
mveCPallini15-Jan-10 10:44 
GeneralRe: system call too small Pin
2buck5615-Jan-10 11:36
2buck5615-Jan-10 11:36 
GeneralRe: system call too small Pin
LunaticFringe15-Jan-10 11:44
LunaticFringe15-Jan-10 11:44 
GeneralRe: system call too small Pin
2buck5615-Jan-10 12:26
2buck5615-Jan-10 12: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 12:49
professionalGarth J Lancaster15-Jan-10 12:49 
GeneralRe: system call too small Pin
LunaticFringe15-Jan-10 13:01
LunaticFringe15-Jan-10 13:01 
GeneralRe: system call too small Pin
2buck5615-Jan-10 13:51
2buck5615-Jan-10 13:51 
GeneralRe: system call too small [modified] Pin
LunaticFringe15-Jan-10 14:31
LunaticFringe15-Jan-10 14:31 
GeneralRe: system call too small Pin
2buck5615-Jan-10 15:02
2buck5615-Jan-10 15:02 
GeneralRe: system call too small Pin
CPallini15-Jan-10 22:02
mveCPallini15-Jan-10 22:02 
GeneralRe: system call too small Pin
CPallini15-Jan-10 22:11
mveCPallini15-Jan-10 22:11 
GeneralRe: system call too small Pin
Garth J Lancaster15-Jan-10 22:41
professionalGarth J Lancaster15-Jan-10 22:41 
GeneralRe: system call too small Pin
CPallini15-Jan-10 22:43
mveCPallini15-Jan-10 22:43 
GeneralRe: system call too small Pin
Garth J Lancaster15-Jan-10 22:59
professionalGarth J Lancaster15-Jan-10 22:59 
GeneralRe: system call too small Pin
CPallini15-Jan-10 23:10
mveCPallini15-Jan-10 23:10 
GeneralRe: system call too small Pin
Bram van Kampen17-Jan-10 6:18
Bram van Kampen17-Jan-10 6:18 
AnswerRe: system call too small Pin
Richard MacCutchan15-Jan-10 23:55
mveRichard MacCutchan15-Jan-10 23:55 
AnswerRe: system call too small Pin
David Crow16-Jan-10 5:06
David Crow16-Jan-10 5:06 
GeneralRe: system call too small Pin
CPallini16-Jan-10 7:57
mveCPallini16-Jan-10 7:57 
GeneralRe: system call too small Pin
2buck5616-Jan-10 11:01
2buck5616-Jan-10 11:01 
QuestionDefault path to Desktop with vista Pin
dbell0715-Jan-10 9:52
dbell0715-Jan-10 9: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.