Click here to Skip to main content
15,893,190 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CreateProcess() not working [modified] Pin
Maxwell Chen20-Feb-08 18:39
Maxwell Chen20-Feb-08 18:39 
GeneralRe: CreateProcess() not working Pin
tony_Udz20-Feb-08 19:09
tony_Udz20-Feb-08 19:09 
GeneralRe: CreateProcess() not working Pin
Rajkumar R20-Feb-08 20:38
Rajkumar R20-Feb-08 20:38 
GeneralEmbedding vlc player in to the application Pin
Chandrasekharan P20-Feb-08 17:32
Chandrasekharan P20-Feb-08 17:32 
GeneralTo embed a word document into a C++ console based exe Pin
Mushtaque Nizamani20-Feb-08 17:26
Mushtaque Nizamani20-Feb-08 17:26 
QuestionRe: To embed a word document into a C++ console based exe Pin
Rajkumar R20-Feb-08 18:07
Rajkumar R20-Feb-08 18:07 
GeneralRe: To embed a word document into a C++ console based exe Pin
Maxwell Chen20-Feb-08 19:05
Maxwell Chen20-Feb-08 19:05 
QuestionA problem when you press ESC in a CEdit ctrl Pin
zengkun10020-Feb-08 16:05
zengkun10020-Feb-08 16:05 
Everyone knows that when you press the 'Enter' key or 'ESC' key in a dialog application, even if in a CEdit ctrl that has focus, the dialog will exit. If you want to prevent this unwantable annoying default behavior, you should write some code.

There is an atricle about how to catch those Enter keys in controls at CP. The author tell us to add a hanled to catch WM_GETDLGCODE message,if the function's return code is DLGC_WANTALLKEYS, then our controls will know every message and we have the right to decide what to do to those 'Enter','ESC' keys.

So I subclass a CEdit class called CMyEdit, and added two message handlers OnGetDlgCode and OnKeyDown. In CMyEdit's OnKeyDown function, I can catch VK_RETURN and VK_ESCAPE, and the dialog will not exit even if Enter or ESC is pressed in the edit ctrl. Hooray! Poke tongue | ;-P

But!!! when I change this CMyEdit from singleline to multiline, everything changed! Now OnKeyDown function will not see VK_ESCAPE any more, but VK_RETURN is still catched. And when the ESC is pressed in the ctrl, dialog exit. Mad | :mad: Why DLGC_WANTALLKEYS doesn't work now?

After I googled for half a day. I found a solution--override CEdit's PreTranslateMessage and catch all key's there.

I want to known why DLGC_WANTALLKEYS works well for single line CEdit but not for multiline?
And which is the best way to prevent dialog from exiting when the ESC or Enter is pressed in a CEdit ctrl?

Thank you all! Smile | :)

A Chinese VC++ programmer

GeneralRe: A problem when you press ESC in a CEdit ctrl Pin
Maxwell Chen20-Feb-08 16:20
Maxwell Chen20-Feb-08 16:20 
GeneralRe: A problem when you press ESC in a CEdit ctrl Pin
zengkun10020-Feb-08 16:39
zengkun10020-Feb-08 16:39 
GeneralRe: A problem when you press ESC in a CEdit ctrl Pin
Maxwell Chen20-Feb-08 16:44
Maxwell Chen20-Feb-08 16:44 
QuestionHow to access Blu-ray discs' video file? Pin
kcynic20-Feb-08 14:54
kcynic20-Feb-08 14:54 
GeneralFunny symbols Reading Registry Key Values Pin
J_E_D_I20-Feb-08 10:14
J_E_D_I20-Feb-08 10:14 
QuestionRe: Funny symbols Reading Registry Key Values Pin
David Crow20-Feb-08 10:43
David Crow20-Feb-08 10:43 
GeneralRe: Funny symbols Reading Registry Key Values Pin
Mark Salsbery20-Feb-08 13:19
Mark Salsbery20-Feb-08 13:19 
GeneralRe: Funny symbols Reading Registry Key Values Pin
Mark Salsbery20-Feb-08 13:23
Mark Salsbery20-Feb-08 13:23 
GeneralRe: Funny symbols Reading Registry Key Values Pin
J_E_D_I21-Feb-08 21:31
J_E_D_I21-Feb-08 21:31 
GeneralRe: Funny symbols Reading Registry Key Values Pin
David Crow22-Feb-08 2:54
David Crow22-Feb-08 2:54 
GeneralRe: Funny symbols Reading Registry Key Values Pin
J_E_D_I22-Feb-08 9:45
J_E_D_I22-Feb-08 9:45 
QuestionRe: Funny symbols Reading Registry Key Values Pin
David Crow22-Feb-08 9:57
David Crow22-Feb-08 9:57 
GeneralHow to Read a Registry Key Value Pin
J_E_D_I22-Feb-08 10:18
J_E_D_I22-Feb-08 10:18 
GeneralDetermine if an exe is running or not Pin
act_x20-Feb-08 10:01
act_x20-Feb-08 10:01 
GeneralRe: Determine if an exe is running or not Pin
David Crow20-Feb-08 10:44
David Crow20-Feb-08 10:44 
GeneralRe: Determine if an exe is running or not Pin
Chris Meech20-Feb-08 11:11
Chris Meech20-Feb-08 11:11 
GeneralRe: Determine if an exe is running or not [modified] Pin
User 238229221-Feb-08 3:22
User 238229221-Feb-08 3:22 

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.