|
i have to implement the fft algorithm for comparing the image obtained from webcam with some standard image stored..
can you please help me with this...
|
|
|
|
|
try typing 'FFT' in the search box at the top of the page . there are a few articles here about FFT.
|
|
|
|
|
Hi,
How do I prevent the escape key, when pressed, from closing a dialog window?
Thanks
neil
|
|
|
|
|
By default the ESC key causes a WM_COMMAND IDCANCEL message to be sent to the dialog proc.
You could catch this message and do nothing. *EDIT* dumb answer
Maybe look for WM_KEYDOWN/WM_KEYUP messages for the ESC key and do nothing in response.
Mark
-- modified at 14:42 Thursday 22nd February, 2007
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
Mark Salsbery wrote: By default the ESC key causes a WM_COMMAND IDCANCEL
No, it doesn't.
Mark Salsbery wrote: Maybe look for WM_KEYDOWN/WM_KEYUP messages for the ESC key and do nothing in response.
What about not dispatching the message if its due to escape key pressed ? (Handling PreTranslateMessage ).
|
|
|
|
|
prasad_som wrote: No, it doesn't.
I guess I was confused by the documented handling of the ESC key which states "Sends a WM_COMMAND
message to the dialog box procedure. The wParam parameter is set to IDCANCEL."
prasad_som wrote: What about not dispatching the message if its due to escape key pressed ?
Which is what I meant by do nothing.
Sorry I don't do English as good as y'all.
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
Mark Salsbery wrote: Which is what I meant by do nothing.
You talked about handling WM_KEYDOWN message. But Instaead PreTranslateMessage would be better place, I wanted to underscore that.
Mark Salsbery wrote: I don't do English as good as y'all.
No, You does, . English is not our native language.
|
|
|
|
|
prasad_som wrote: ou talked about handling WM_KEYDOWN message. But Instaead PreTranslateMessage would be better place,
You may also want to tell him clearly that WM_KEYDOWN won't help at all, with these two keys.
He is no fool who gives what he cannot keep to gain what he cannot lose.
- Jim Elliot
|
|
|
|
|
prasad_som wrote: But Instaead PreTranslateMessage would be better place, I wanted to underscore that.
I agree. The OP didn't mention MFC. I guess it's a 50-50 shot. I try not to assume
Cheers!
Mark
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
Mark Salsbery wrote: Maybe look for WM_KEYDOWN/WM_KEYUP messages for the ESC key and do nothing in response.
I don't think so. When the user presses the Esc or Enter, CDialog implementations will call EndDialog() immediately rather than passing on this message to WM_KEYDOWN handler. So the handler floats sadly in thin air. There is a lot of confusion on this and I do not find a better way than overriding the PreTranslateMessage</s>
Please read This[^] too!
Last modified: 17mins after originally posted --
The greater the difficulty, the greater the glory.
- Marcus Tullius Cicero
|
|
|
|
|
LOL I get it! The OP did not mention MFC - you all assumed that - you got it right...good for
you.
Most times that I assume that, the OP comes back and tells me "I'm not using MFC". I can't win.
I suggested eating the ESC key, exactly what Prasad did in his PreTranslateMsg handler.
You are right it won't work in an MFC OnKeyDown handler - the key has been translated at that
point so an escape key never gets there. That's why in MFC it needs to be caught in
PreTranslateMsg.
In non MFC you'd have to look for the WM_KEYDOWN and not pass it on to be translated.
Either way you're eating the keystroke
Cheers!
Mark
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
You can catch pressed key
if (key==VK_ESC)
flag=true;
and in OnClosing method you can check the flag if it's true, you can forbid closing the dialog. Or after handling VK_ESC key pressed you can change it into some other key so that program would think the ESC wasn't pressed.
|
|
|
|
|
I suppose you are using MFC ? If yes, look at the FAQ here[^]
|
|
|
|
|
NeilDevlin wrote: How do I prevent the escape key, when pressed, from closing a dialog window?
handle onCancel virtual function of CDialog Class
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
ThatsAlok wrote: handle onCancel virtual function of CDialog Class
If you do this, then clicking the cancel button or the close button (the X button) also won't close the dialog. Am I right?
The greater the difficulty, the greater the glory.
- Marcus Tullius Cicero
|
|
|
|
|
brahmma wrote: Am I right?
as usual you are right
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thanks I always have wondered why there are no other good ways than handling the PreTranslateMessage to sort this 'It closes if I press the Esc button' issue out. I find handling PreTranslateMessage to be a weird way but that is the only effective way I know to do this.
Last modified: 2hrs 7mins after originally posted --
Glory follows virtue as if it were its shadow.
- Marcus Tullius Cicero
|
|
|
|
|
There is. If you want the close button to still work then handle the WM_CLOSE message and call CDialog::OnCancel from there and override OnCancel() and do nothing.
void CMyDialog::OnClose()
{
CDialog::OnCancel();
}
void CMyDialog::OnCancel()
{
}
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Thank you very much Arends. If I was asked to guess who would teach me this, I would have told your name
Let us not listen to those who think we ought to be angry with our enemies, and who believe this to be great and manly. Nothing is so praiseworthy, nothing so clearly shows a great and noble soul, as clemency and readiness to forgive.
- Marcus Tullius Cicero
|
|
|
|
|
Use PreTranslateMessage .
BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN)
{
int nKey = pMsg->wParam ;
if ( nKey == VK_ESCAPE )
{
return TRUE;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
|
|
|
|
|
Fast man! I was about to type it, but had to ask Alok a question
He is no fool who gives what he cannot keep to gain what he cannot lose.
- Jim Elliot
|
|
|
|
|
Taken chance, when you was not alert.
|
|
|
|
|
Override OnCancel() . To allow the window to be closed, call CDialog::OnCancel() , otherwise don't.
/ravi
|
|
|
|
|
(Sorry for the cross posting, but I figured there may be people here who don't visit the lounge.)
Are there any DirectShow gurus here? (I'd rather ask some complex questions to someone with a ready answer than wade through Microsoft's absolutely horrible documentation on this.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I'm no guru but I use DirectShow quite a bit.
If nothing else I can probably direct you to the right place in the documentation
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|