|
My app shows the dialog box in a modal (topmost) window.
The purpose of the app is to give feedback to the user about the button pressed on the keyboard, however, whenever I press the ESC or Space keys, the IDCANCEL or IDOK buttons are "pressed".
Is it possible to prevent this behavior ?
(I want those buttons only to be used by the user via mouse click to exit the app. The "Default Button" property for the buttons is set to False)
thankyou !
|
|
|
|
|
you need to add a PreTranslateMsg handler and eat the Escape & Space keys.
|
|
|
|
|
I am studying this now. Found a good example here http://www.codeguru.com/forum/archive/index.php/t-203713.html
thanks !!
|
|
|
|
|
abiemann wrote: Is it possible to prevent this behavior ?
Yes. See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I've added BN_CLICKED handlers:
S2000_CP_DLG::OnExitOK()
S2000_CP_DLG::OnExitCANCEL()
and for good measure I've stubbed-out the base functions: (probably unnecessary)
S2000_CP_DLG::OnOK()
S2000_CP_DLG::OnCancel()
so what happens now is that when I press [Esc] the OnExitCANCEL() is called.
When I press [Enter] or [Space] the OnExitOK() is called.
but since the app has to run through some code when OK and CANCEL are clicked I can't just leave the handlers empty.
Hence, within the handlers I think I need to detect if the keyboard was used to click the button. If no, then proceed with processing and close the dialog. If yes, then exit the handler.
I just don't know how to detect if the keyboard was used to enter OnExitOK and OnExitCANCEL.
|
|
|
|
|
I got it fixed:
I went back to the Dialog Editor, deleted the BN_CLICKED handlers from the IDOK and IDCANCEL buttons. Then I made the default OK and CANCEL buttons invisible and changed their captions to "ignore".
Subsequently I added 2 new buttons: "OK" and "CANCEL" and added the BN_CLICKED handlers to handle the closing of the Dialog.
Now the user can press [Enter], [Esc], and [Space] without any problem what-so-ever and when the user wants exit - the OK and CANCEL buttons will do just that
|
|
|
|
|
This one has been bugging me all day. I'm trying to fill a consoles screen with null characters using FillConsoleOutputCharacter() passing '\0' as the character. This works flawlessly in a non-unicode build, but after switching to unicode it just doesn't work.
After reading the buffer it becomes apparant that the screen was filled with spaces 0x0020. Thinking it was a problem with the null character I then tried '0x0A' and '0x000A' both of which fill the buffer with '0x25D9'.
Do I need to do anything special before trying to fill with a unicode null character, or does the function just not work in a unicode build?
|
|
|
|
|
The unicode implementation is FillConsoleOutputCharacterW().
|
|
|
|
|
And the ANSI implementation is FillConsoleOutputCharacterA(), both of which are mapped accordingly depending if UNICODE is defined. So how does this relate to my question?
|
|
|
|
|
Brain fart, my apologies.
|
|
|
|
|
Hello 2 everyone interested!
I have installed Visual Studio 2005 8 in D:\Program Files\ and WM SDK 5.0 in C:\Program Files\.
The WM5 SDK comes with a few samples, and I've chosen the bluetooth one, named BTSeach (I've seen it between codeproject's articles, too). I've launched it from the default directory:
C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Samples\CPP\Win32\Bluetooth
When I compile it i get 2 errors, and I didn`t modify anything (anyway it's an linking error, so I guess the filepaths aren't correctly set). The output is:
------ Build started: Project: btsearch, Configuration: Debug Windows Mobile 5.0 Pocket PC SDK (ARMV4I) ------
Linking...
btsearch.obj : error LNK2001: unresolved external symbol __GSHandlerCheck
Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\Debug/btsearch.exe : fatal error LNK1120: 1 unresolved externals
Build log was saved at "file://c:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Samples\CPP\Win32\Bluetooth\btsearch\Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\Debug\BuildLog.htm"
btsearch - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Does any of you know where I should write the paths for files which should resolve this linking issues?
Thank you a lot!
Shpid3r
|
|
|
|
|
Did you add the SDK path to Visual Studio?
Tools > Options > Projects and Solutions > VC++ Directories
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
I`re solved this problem, and I`d like to post here, to help one who gets stuck in the same spot.
The problem seems to be the Service Pack 1 update. This is a known issue, and on microsoft site ( http://support.microsoft.com/kb/928957/ ) it`s posted this:
Error LNK2019: unresolved external symbol __GSHandlerCheck
Samples in both the Windows Mobile 5.0 SDK for Pocket PC and the Windows Mobile 5.0 SDK for Smartphone are affected by this issue.
Visual Studio 2005 SP1 updates the Visual Studio compilers with the /GS support that is already available in Windows CE 6.0 compilers. Link errors will occur in native C++ Smart Device projects that do not explicitly link to "libcmt.lib" or that have turned off /GS, and that are running on pre-Windows Embedded CE 6.0 platforms.
To resolve this issue:
1. Explicitly include "libcmt.lib" in the list of additional libraries to link against.
2. Turn off the linker warning (/nowarn:4099)
I didn`t actually manage to do this, but I've done something else. I`ve basically searched my WM5 SDK for 'libcmt.lib' (found around 7 results) and picked the one addressing the platform I was writing code for (that is AVRM4I). And simply added it to my project (add file to project > existing file). The warn doesn`t bother me.
---------
To more projects to u all
|
|
|
|
|
Can you help me.
Help to be going to create Virtual IP using "iphlp" libarary raise just there is example code using c++
wait for your advice.
thank you.
ps : thanks is add "iphlp" library fils(iphlp.h , iphlp.dll ...)
|
|
|
|
|
It is been quite a while. I have a task to identify a calling Windows' batch script's name and its location. Basically, the batch script calls/spawns my C++ executable as a parent process and I failed to identify the parent. I can identify a number of different calling processes using NtQueryInformationProcess(), but failed to do so to the batch script. The main reason is that the batch process is shown as cmd.exe not a real script name.
Thanks a lot for the help.
|
|
|
|
|
Hi,
I'm trying to print the name of the function I'm in for a trace routine that displays the name of the source file and perhaps the function name.
Is there a built in MACRO that already does that?
Thanks.
|
|
|
|
|
Like2Byte wrote: Is there a built in MACRO that already does that?
I don't know. Maybe they hide that information in the documentation[^] like usual
|
|
|
|
|
It's always one keyword away. Thanks. I wasn't using the word 'Predefined' in my search - I did look, though.
Thanks again.
|
|
|
|
|
__FILE__
__FUNCTION__
http://msdn2.microsoft.com/en-us/library/b0084kay(VS.71).aspx[^]
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
|
in my app i use this line:
SetIcon(AfxGetApp()->LoadIcon(IDI_NEW_ICON), TRUE);
IDI_NEW_ICON is name of the icon listed in the resource editor.
|
|
|
|
|
Thanks
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
|
|
|
|
|
I want to use SetWaitableTimer() to wake up system.
I use the following code :
<br />
void SetTimer()<br />
{<br />
HANDLE hTimer = NULL;<br />
LARGE_INTEGER liDueTime;<br />
__int64 qwDueTime;<br />
<br />
hTimer = CreateWaitableTimer(NULL, TRUE, "C&E RC WaitableTimer");<br />
<br />
SYSTEMTIME stStartTime<br />
CTime StartTime<br />
currentTime.GetAsSystemTime(st);<br />
<br />
CTimeSpan tsOneDay(0, 0, 1, 0);<br />
<br />
time = time + tsOneDay;<br />
time.GetAsSystemTime(stStartTime);<br />
<br />
FILETIME filetime;<br />
<br />
SystemTimeToFileTime(&stStartTime, &filetime);<br />
<br />
liDueTime.LowPart = filetime.dwLowDateTime;<br />
liDueTime.HighPart = filetime.dwHighDateTime;<br />
<br />
SetWaitableTimer(hTimer, &liDueTime, 0, NULL, NULL, TRUE);
}
I would like to specify absolute time, but it doesn' work !
The absolute time in this example is one minute from current time.
-- modified at 19:49 Tuesday 4th September, 2007
|
|
|
|
|
peteryenyen wrote: but it doesn' work !
That's not specific and your code won't compile so of course it doesn't work.
|
|
|
|
|
I modify the code. Please take a look at it.
|
|
|
|