|
I had few CBitmapButton(s) on a CDIalogBar, but I had noticed that they are not react on Enter key, only on mouse click ? How can I workaround in order to react on enter key ? Thank you.
|
|
|
|
|
Where is the focus when you press the enter key?
Veni, vidi, abiit domum
|
|
|
|
|
On the CBitmapButton, of course
|
|
|
|
|
I know what you are trying to say, that the focus is stealing by CMainFrame, but I must say that CBitmapButton react on "SPACE" key, so that is the prove that the button had th focus ...
|
|
|
|
|
Flaviu2 wrote: I know what you are trying to say Actually, I was not trying to say anything, merely asking the obvious question. I had a good root through the documentation for this control and cannot find anything in MSDN that explains what is supposed to happen. I know that in a normal dialog it will work this way, but I don't have MFC so cannot make a sample to test what you are trying to do.
Veni, vidi, abiit domum
|
|
|
|
|
Ok, I understand. Thank you for your concern.
|
|
|
|
|
hi all,
I am get window text like this in my function it works fine for multibyte data but fails in case of Unicode data.
HWND hWnd;
char string [256]={_T('\0')};
::SendMessage(hWnd, WM_GETTEXT, 255, (LPARAM)string);
and
TCHAR szBuffer[MAX_PATH] = {_T('\0')};
SendMessage(hWnd, WM_GETTEXT, sizeof(szBuffer) / sizeof(TCHAR), (LPARAM)szBuffer);
please help me to get the Unicode data.
thank in advance.
|
|
|
|
|
I have used the same code as you have above to receive the Unicode text from a window. Are you sure you set the project options to select a UNICODE build?
Veni, vidi, abiit domum
modified 15-Nov-13 9:02am.
|
|
|
|
|
|
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.
|
|
|
|
|
Sounds like a possible recursion issue. What happens if you comment out the call to SetLocalTime() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
modified 14-Nov-13 15:17pm.
|
|
|
|
|
The stack overflow message doesn't appear but the new date doesn't get set.
CB
|
|
|
|
|
After SetLocalTime() is called, how many times does OnBnClickedButtonSet() get called?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Only one time..The user inputs the day, month and year and/or time and then presses on Set button which calls SetLocalTime().
|
|
|
|
|
Yes,I know... I was thinking that maybe SetLocalTime() calles a hidden WM_something that gives the recursion issue? Do you know if this could be the case? I couldn't find anything by searching on google or reading the function description on microsoft help page...
|
|
|
|
|
corina.beer wrote: Do you know if this could be the case? Set a breakpoint and find out.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
The problem was calling a delete function on a timer in my base class... I have removed that function and Set button works all the time. If I put the function back on timer, the stack overflow message shows up again.
Thanks everyone for your suggestions.
CB
|
|
|
|
|
This just about points to passing bad data to SetLocalTime(), any way you can check it prior to sending it to SetLocalTime()?
Are you sure m_Time.GetTime(&new_time) is returning a valid time every time (keep in mind the debugger will initialize uninitialized data but this won't be the case in the release version)?
|
|
|
|
|
Thanks.
Stack overflow happens in release mode as well.
Yes, I was thinking of that too. I checked with a breakpoint and all the values for time were all right - no weird looking data...I will run in in Debug and put a TRACE with all the time values to make sure. Also maybe calling UpdateData before SetLocalTime might help? ...I will try that too.
|
|
|
|
|
corina.beer wrote: I checked with a breakpoint and all the values for time were all right - no weird looking data...I will run in in Debug and put a TRACE
You can't break and look at values on a release version (data will be bogus).
|
|
|
|
|
Albert Holguin wrote: You can't break and look at values on a release version Are you sure? I've debugged a release build before. All it needed was the PDB file.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Not completely sure... I know you can break, but the values it shows you won't always be accurate (at least that's what I've found). So I don't do it at all anymore... I only use breaks in debug builds.
|
|
|
|
|
There is OutputDebugString() function I can use to display the values in Release mode. I will try it...
|
|
|
|
|
Helloo..
Help me plz............
I have two different applications (SDI).
I want to call the second application from the button click of the first (without calling the EXE).
Let me know how I can call?????
|
|
|
|
|
sachanratnesh wrote: without calling the EXE Then you need to convert it to a DLL, or a COM server.
Veni, vidi, abiit domum
|
|
|
|