Click here to Skip to main content
15,899,025 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to hide a shortcut from desktop window? Pin
shoma14-Mar-04 15:57
shoma14-Mar-04 15:57 
Generalabout TAPI Pin
denly11-Mar-04 17:23
denly11-Mar-04 17:23 
GeneralRe: about TAPI Pin
Tarundeep Singh Kalra11-Mar-04 19:49
Tarundeep Singh Kalra11-Mar-04 19:49 
GeneralLexical/Char Sequence Increment Pin
Garth J Lancaster11-Mar-04 17:19
professionalGarth J Lancaster11-Mar-04 17:19 
GeneralRe: Lexical/Char Sequence Increment Pin
Chris Richardson12-Mar-04 14:44
Chris Richardson12-Mar-04 14:44 
GeneralRe: Lexical/Char Sequence Increment Pin
Garth J Lancaster12-Mar-04 14:58
professionalGarth J Lancaster12-Mar-04 14:58 
QuestionMFC: Easier way to know which Edit Control has the focus? Pin
Davex_11-Mar-04 16:42
Davex_11-Mar-04 16:42 
AnswerRe: MFC: Easier way to know which Edit Control has the focus? Pin
GDavy11-Mar-04 21:41
GDavy11-Mar-04 21:41 
just make sure your resource ID`s are in consecutive
eg
IDC_NAME1=21
IDC_NAME2=22
.
.
.
IDC_NAME26=46

and then you could use in messagemap:

ON_NOTIFY_RANGE( NM_SETFOCUS, IDC_NAME1, IDC_NAME26, SetPlayerFocus )
define SetPlayerFocus in header as:
afx_msg void SetPlayerFocus(UINT nid, NMHDR* pNotifyStruct, LRESULT* pResult);



void CMainView::SetPlayerFocus(UINT nid, NMHDR* pNotifyStruct, LRESULT* pResult)
{
m_nPlayerWithFocus = nid - IDC_NAME1 +1 ; //results in 1 for player1 etc...
pResult = 0;
}



void CMainView::OnPrintPlayer()
{
// print whatever you like, m_nPlayerWithFocus contains value of last edit field that had focus
}
I think that should roughly do the trick...

.
.
.
.

other option, maybe even better skip the setfocus function just do:

void CMainView::OnPrintPlayer()
{
CWnd * wndFoc = GetFocus();
if( !wndFoc )
return;

int nCurrentPlayer = wndFoc->GetDlgCtrlID() - IDC_NAME1 +1;
if( 0<nCurrentPlayer && MAX_PLAYERS >=nCurrentPlayer )
PrintResultsFor(nCurrentPlayer);
}


AnswerRe: MFC: Easier way to know which Edit Control has the focus? Pin
Roger Allen12-Mar-04 1:23
Roger Allen12-Mar-04 1:23 
GeneralRe: MFC: Easier way to know which Edit Control has the focus? Pin
Davex_12-Mar-04 4:13
Davex_12-Mar-04 4:13 
AnswerRe: MFC: Easier way to know which Edit Control has the focus? Pin
David Crow12-Mar-04 2:29
David Crow12-Mar-04 2:29 
GeneralMenu properties Pin
Member 80845911-Mar-04 16:37
Member 80845911-Mar-04 16:37 
GeneralRe: Menu properties Pin
toxcct11-Mar-04 21:40
toxcct11-Mar-04 21:40 
GeneralRe: Menu properties Pin
Bin2Hex11-Mar-04 22:52
Bin2Hex11-Mar-04 22:52 
GeneralRe: Menu properties Pin
David Crow12-Mar-04 2:30
David Crow12-Mar-04 2:30 
GeneralRe: Menu properties Pin
Bin2Hex12-Mar-04 3:11
Bin2Hex12-Mar-04 3:11 
GeneralRe: Menu properties Pin
Chris Richardson12-Mar-04 20:32
Chris Richardson12-Mar-04 20:32 
GeneralHelp in MFC intercept TCP Calls Pin
Member 91913011-Mar-04 15:35
Member 91913011-Mar-04 15:35 
GeneralRe: Help in MFC intercept TCP Calls Pin
l a u r e n11-Mar-04 15:43
l a u r e n11-Mar-04 15:43 
GeneralStep by step tooltips implementation using Visual C++ and mfc Pin
MeterMan11-Mar-04 14:30
MeterMan11-Mar-04 14:30 
GeneralRe: Step by step tooltips implementation using Visual C++ and mfc Pin
Florin Ochiana11-Mar-04 23:33
Florin Ochiana11-Mar-04 23:33 
GeneralRe: Step by step tooltips implementation using Visual C++ and mfc Pin
MeterMan12-Mar-04 10:47
MeterMan12-Mar-04 10:47 
GeneralTimerQueue timers not accurate on Dual Processors Pin
Gavin Stark11-Mar-04 7:03
Gavin Stark11-Mar-04 7:03 
GeneralMSFlexGrid function Pin
catngo11-Mar-04 6:20
catngo11-Mar-04 6:20 
GeneralRe: MSFlexGrid function Pin
Steve S11-Mar-04 6:27
Steve S11-Mar-04 6:27 

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.