Click here to Skip to main content
15,906,455 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Create a file, containing folder contents Pin
Nelek4-Nov-07 21:51
protectorNelek4-Nov-07 21:51 
Questionlocal system account Pin
ginjikun3-Nov-07 22:59
ginjikun3-Nov-07 22:59 
QuestionNetwork Monitor Pin
AhmedOsamaMoh3-Nov-07 21:46
AhmedOsamaMoh3-Nov-07 21:46 
QuestionExport string from Dll Pin
Max++3-Nov-07 21:02
Max++3-Nov-07 21:02 
QuestionTracking a mouse movement inside a dialog without Tab controls Pin
Larry Mills Sr3-Nov-07 15:39
Larry Mills Sr3-Nov-07 15:39 
AnswerRe: Tracking a mouse movement inside a dialog without Tab controls Pin
Nelek4-Nov-07 21:41
protectorNelek4-Nov-07 21:41 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls Pin
Larry Mills Sr5-Nov-07 5:57
Larry Mills Sr5-Nov-07 5:57 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls [modified] Pin
Nelek5-Nov-07 20:30
protectorNelek5-Nov-07 20:30 
I didn't say SetFocus (), I did say OnSetFocus () or said in another form EN_SETFOCUS

This message is sent every time a edit box gets the focus by selection, before/while the carpet appears in it.

So the user klick in the control, the message is sent.

I use EN_SETFOCUS to know when the user has the input focus in an edit box by setting a bool and EN_KILLFOCUS to reset the bool because the user has clicked outside giving the focus to another control or the parent window.

So I can differenciate some things and call one function or another when a key (i.e. enter) is pressed.

In example:
//in header
	afx_msg void OnSetFocusMyEdit1 ();
	afx_msg void OnKillFocusMyEdit1 ();

//in code
BEGIN_MESSAGE_MAP(CMyFormView, CFormView)
	ON_EN_SETFOCUS(IDC_SIG_MYEDIT1, OnSetFocusMyEdit1)
	ON_EN_KILLFOCUS(IDC_SIG_MYEDIT1, OnKillFocusMyEdit1)
//....
END_MESSAGE_MAP()
//
void CMyFormView::OnSetFocusMyEdit1 ()
{
   m_bEdit1Focus = TRUE;
   return;
}

void CMyFormView::OnKillFocusMyEdit1 ()
{
   m_bEdit1Focus = FALSE;
   return;
}

void CMyFormView::OnHotKeyEnterPressed ()
{
   if (m_bEdit1Focus)
   {  CalculateSomeStuffWithEdit1Value ();
      return;
   }

   if (m_bEdit2Focus)
   {  ValidateTheEdit2Value ();
      DoAnotherStuff ();
      return;
   }

   //more things...

   DestroyWindow ();
}


So if Enter is pressed while an edit has the focus, I get the data, validate it, make whatever I need and wait to next command. If the enter is pressed when nothing is focused, I close my window.

EDIT: As I saw the other messages, I have added the bolded code.
NOTE: I use VC++ 6, but I guess it will work in VS2005


-- modified at 2:37 Tuesday 6th November, 2007

Greetings.

--------
M.D.V.

If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?

Help me to understand what I'm saying, and I'll explain it better to you

Wink | ;)

AnswerRe: Tracking a mouse movement inside a dialog without Tab controls Pin
Mark Salsbery5-Nov-07 5:54
Mark Salsbery5-Nov-07 5:54 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls Pin
Larry Mills Sr5-Nov-07 6:03
Larry Mills Sr5-Nov-07 6:03 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls Pin
Mark Salsbery5-Nov-07 6:34
Mark Salsbery5-Nov-07 6:34 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls [modified] Pin
Larry Mills Sr5-Nov-07 9:10
Larry Mills Sr5-Nov-07 9:10 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls Pin
Mark Salsbery5-Nov-07 10:48
Mark Salsbery5-Nov-07 10:48 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls Pin
Larry Mills Sr5-Nov-07 11:25
Larry Mills Sr5-Nov-07 11:25 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls Pin
Mark Salsbery5-Nov-07 11:45
Mark Salsbery5-Nov-07 11:45 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls Pin
Larry Mills Sr6-Nov-07 2:59
Larry Mills Sr6-Nov-07 2:59 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls Pin
Mark Salsbery6-Nov-07 4:43
Mark Salsbery6-Nov-07 4:43 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls Pin
Larry Mills Sr6-Nov-07 5:45
Larry Mills Sr6-Nov-07 5:45 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls Pin
Mark Salsbery6-Nov-07 8:03
Mark Salsbery6-Nov-07 8:03 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls Pin
Larry Mills Sr6-Nov-07 10:05
Larry Mills Sr6-Nov-07 10:05 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls Pin
Mark Salsbery6-Nov-07 10:15
Mark Salsbery6-Nov-07 10:15 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls Pin
Nelek6-Nov-07 21:06
protectorNelek6-Nov-07 21:06 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls [modified] Pin
Larry Mills Sr7-Nov-07 4:00
Larry Mills Sr7-Nov-07 4:00 
GeneralRe: Tracking a mouse movement inside a dialog without Tab controls Pin
Nelek14-Nov-07 3:35
protectorNelek14-Nov-07 3:35 
Questionfolder constants (for opening) Pin
shpid3r3-Nov-07 12:59
shpid3r3-Nov-07 12:59 

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.