|
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."
|
|
|
|
|
Since my posting, some of my questions were resolved by running a simple test that showed our embedded hardware simply couldn't do what the bosses originally requested. However, we're moving on to plan B, which still leaves some open questions.
The main one is whether there is a straightforward method of capturing video straight to memory (no preview)?
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
My solution was to use a custom renderer filter. It's implemented as a renderer so it handles
all the necessary allocator stuff but instead of rendering it calls a callback function for each
frame of video.
It's similar to a frame grabber filter but is a renderer - only has an input pin.
I used one of the DirectShow samples as a starting point - I'm trying to figure out which one
it was! I'm pretty sure it was the "Grabber Filter Sample".
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."
|
|
|
|
|
hi,
someone could explain to me how it works and with a simple example how could i after:
OpenProcess(); then -> duplicatehandles() into the currentprocess how can i use NtQueryObject to list the open objects handles from that current process..
my problem is how can i list the objects, i cant realy understand very much from the examples in this forum, or in some webpages, coz the examples are very diferent and use structures in c++...
if someone could just give a simple example, i dont know if i do NtQueryObject to the handle that was stored the duplicateHandle() information and how can i list... coz i use toolhelp32 to get processid and other information and to list the process's you have functions like process32next to go into the next line and next line to list the process's but in NtQueryObject i dont understand how to list...
pls help thanks
|
|
|
|
|
van-ux wrote: ...the examples are very diferent and use structures in c++...
Here is a non-C++ example.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
That example uses a bunch of structures!
"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."
|
|
|
|
|
Hi,
I was wondering what is the maximum limit (size) of an RWCString. I believe, it used to be 64K with 16 bit plateforms. Is there any limitations in 32 bit and 64 bit plateforms?
Will appreciate if you could provide me this info.
THanks
|
|
|
|
|
You have the source code, so why don't you look yourself? My guess is 2 billion characters (MAX_INT).
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
RWCString::length() returns maximum byte count of size_t
|
|
|
|
|
|
I've been looking all over for an answer to this, no luck, so maybe someone here has encountered it before...
I'm using DirectShow to do a video app, and creating another window on the secondary monitor for the mixed output from multiple graphs.
I won't bore you with all the DS details of the allocator/swap chain, but it works ok. The problem is, when the window is created on the secondary monitor, the CPU usage runs 90-100%, and the app is not robust, to say the least.
If the window is created on the primary monitor, no problem with CPU usage.
I see that with DS sample apps as well, when you drag them to the 2nd (dual view), they eat up much more usage.
I can run VJ type apps that do similar, and they seem to work fine on the same hardware setup, so I doubt it's hardware/driver related, probably more to do with how I'm creating the window (standard CreateEx stuff).
If anyone has done this sort of stuff before, I would love to hear how you did it, as it's very frustrating, with the docs being so bad for DS...
Thanx.
|
|
|
|
|
What video renderer filter are you using?
"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."
|
|
|
|