Click here to Skip to main content
15,890,186 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Catch ENTER key on CBitmapButton Pin
_Flaviu15-Nov-13 3:02
_Flaviu15-Nov-13 3:02 
AnswerRe: Catch ENTER key on CBitmapButton Pin
_Flaviu17-Nov-13 21:33
_Flaviu17-Nov-13 21:33 
GeneralRe: Catch ENTER key on CBitmapButton Pin
Richard MacCutchan17-Nov-13 22:01
mveRichard MacCutchan17-Nov-13 22:01 
GeneralRe: Catch ENTER key on CBitmapButton Pin
_Flaviu17-Nov-13 22:06
_Flaviu17-Nov-13 22:06 
QuestionSendMessage for WM_GETTEXT not working in case of unicode data. Pin
Le@rner15-Nov-13 0:50
Le@rner15-Nov-13 0:50 
QuestionRe: SendMessage for WM_GETTEXT not working in case of unicode data. Pin
Richard MacCutchan15-Nov-13 2:54
mveRichard MacCutchan15-Nov-13 2:54 
AnswerRe: SendMessage for WM_GETTEXT not working in case of unicode data. Pin
Le@rner15-Nov-13 17:12
Le@rner15-Nov-13 17:12 
QuestionStack overflow after calling SetLocalTime in visual studio 2008 Pin
corina.beer14-Nov-13 0:21
corina.beer14-Nov-13 0:21 
Hi all,

I am getting a weird stack overflow after calling the MFC function SetLocalTime. There is no code to step into and no call stack. I am using Visual Studio 2008 on Windows CE.

Here is my code:

void OnBnClickedButtonSet()
{
SYSTEMTIME time, new_time;
GetLocalTime(&time);

//get the date info
time.wYear = static_cast<WORD>(i_year);
time.wMonth = static_cast<WORD>(i_month);
time.wDay = static_cast<WORD>(i_day);

//get the time info
DWORD ret = m_Time.GetTime(&new_time);
if (ret == GDT_VALID)
{
time.wHour = new_time.wHour;
time.wMinute = new_time.wMinute;
time.wSecond = new_time.wSecond;
time.wMilliseconds = 0;
}
else
{
TRACE(_T("not a time format\n"));
return;
}

CString str(_T(""));

//set the date and time
if (!SetLocalTime(&time))
{
str.Format(_T("system time error = %d. \n"), GetLastError());
TRACE(str);
return;
}//here the stack overflow message shows up; it only happens the first time i turn the unit on and if the user chooses new values only for the date (no stack overflow when setting the time).
}

SetLocalTime doesn't return an error and sets the chosen values for date/time, even if WindowsCE crashes and it needs restarting. After restarting, the date and time can be set again without any problems...

The Disassembly Window points here: "40060198 stmdb sp!, {r0, r4, r5, lr}". I don't know if this is helpful or not...

I tried SecureZeroMemory(&time, sizeof(time)) before GetLocalTime(&time) but no change.

Thanks in advance for your help.
CB


modified 14-Nov-13 10:34am.

QuestionRe: Stack overflow after calling SetLocalTime in visual studio 2008 Pin
David Crow14-Nov-13 7:57
David Crow14-Nov-13 7:57 
AnswerRe: Stack overflow after calling SetLocalTime in visual studio 2008 Pin
corina.beer14-Nov-13 8:18
corina.beer14-Nov-13 8:18 
QuestionRe: Stack overflow after calling SetLocalTime in visual studio 2008 Pin
David Crow14-Nov-13 9:12
David Crow14-Nov-13 9:12 
AnswerRe: Stack overflow after calling SetLocalTime in visual studio 2008 Pin
corina.beer14-Nov-13 9:24
corina.beer14-Nov-13 9:24 
AnswerRe: Stack overflow after calling SetLocalTime in visual studio 2008 Pin
corina.beer14-Nov-13 9:38
corina.beer14-Nov-13 9:38 
SuggestionRe: Stack overflow after calling SetLocalTime in visual studio 2008 Pin
David Crow14-Nov-13 10:10
David Crow14-Nov-13 10:10 
AnswerRe: Stack overflow after calling SetLocalTime in visual studio 2008 Pin
corina.beer15-Nov-13 5:47
corina.beer15-Nov-13 5:47 
AnswerRe: Stack overflow after calling SetLocalTime in visual studio 2008 Pin
Albert Holguin14-Nov-13 8:28
professionalAlbert Holguin14-Nov-13 8:28 
GeneralRe: Stack overflow after calling SetLocalTime in visual studio 2008 Pin
corina.beer14-Nov-13 8:44
corina.beer14-Nov-13 8:44 
GeneralRe: Stack overflow after calling SetLocalTime in visual studio 2008 Pin
Albert Holguin14-Nov-13 8:47
professionalAlbert Holguin14-Nov-13 8:47 
GeneralRe: Stack overflow after calling SetLocalTime in visual studio 2008 Pin
David Crow14-Nov-13 9:16
David Crow14-Nov-13 9:16 
GeneralRe: Stack overflow after calling SetLocalTime in visual studio 2008 Pin
Albert Holguin14-Nov-13 9:22
professionalAlbert Holguin14-Nov-13 9:22 
GeneralRe: Stack overflow after calling SetLocalTime in visual studio 2008 Pin
corina.beer14-Nov-13 9:27
corina.beer14-Nov-13 9:27 
Generalcall the another application from first (without calling the EXE) Pin
sachanratnesh13-Nov-13 19:58
sachanratnesh13-Nov-13 19:58 
GeneralRe: call the another application from first (without calling the EXE) Pin
Richard MacCutchan13-Nov-13 21:38
mveRichard MacCutchan13-Nov-13 21:38 
GeneralRe: call the another application from first (without calling the EXE) Pin
sachanratnesh13-Nov-13 22:47
sachanratnesh13-Nov-13 22:47 
GeneralRe: call the another application from first (without calling the EXE) Pin
Richard MacCutchan13-Nov-13 22:54
mveRichard MacCutchan13-Nov-13 22:54 

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.