Click here to Skip to main content
15,902,938 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Visual C++ 2008 mis-compiling :: re-listing of query. Pin
Anthony Appleyard1-Dec-13 1:52
Anthony Appleyard1-Dec-13 1:52 
GeneralRe: Visual C++ 2008 mis-compiling :: re-listing of query. Pin
Richard MacCutchan1-Dec-13 2:56
mveRichard MacCutchan1-Dec-13 2:56 
GeneralRe: Visual C++ 2008 mis-compiling :: re-listing of query. Pin
Anthony Appleyard1-Dec-13 3:26
Anthony Appleyard1-Dec-13 3:26 
AnswerRe: Visual C++ 2008 mis-compiling Pin
jschell2-Dec-13 10:03
jschell2-Dec-13 10:03 
GeneralRe: Visual C++ 2008 mis-compiling Pin
Anthony Appleyard2-Dec-13 11:14
Anthony Appleyard2-Dec-13 11:14 
GeneralRe: Visual C++ 2008 mis-compiling Pin
ahmad_ali2-Dec-13 23:36
ahmad_ali2-Dec-13 23:36 
GeneralRe: Visual C++ 2008 mis-compiling Pin
Anthony Appleyard3-Dec-13 6:33
Anthony Appleyard3-Dec-13 6:33 
QuestionMaking icons? Pin
Anthony Appleyard29-Nov-13 23:13
Anthony Appleyard29-Nov-13 23:13 
AnswerRe: Making icons? Pin
Richard MacCutchan29-Nov-13 23:59
mveRichard MacCutchan29-Nov-13 23:59 
AnswerRe: Making icons? Pin
Richard Andrew x6430-Nov-13 7:53
professionalRichard Andrew x6430-Nov-13 7:53 
GeneralRe: Making icons? Pin
David Crow30-Nov-13 14:56
David Crow30-Nov-13 14:56 
AnswerRe: Making icons? Pin
«_Superman_»1-Dec-13 18:42
professional«_Superman_»1-Dec-13 18:42 
GeneralIn conjunction with Pin
enhzflep3-Dec-13 6:43
enhzflep3-Dec-13 6:43 
AnswerRe: Making icons? Pin
Joe Woodbury2-Dec-13 9:02
professionalJoe Woodbury2-Dec-13 9:02 
QuestionVisual C++ 2008 query Pin
Anthony Appleyard29-Nov-13 21:38
Anthony Appleyard29-Nov-13 21:38 
AnswerRe: Visual C++ 2008 query Pin
Jochen Arndt29-Nov-13 22:14
professionalJochen Arndt29-Nov-13 22:14 
GeneralRe: Visual C++ 2008 query Pin
Anthony Appleyard29-Nov-13 22:48
Anthony Appleyard29-Nov-13 22:48 
GeneralRe: Visual C++ 2008 query Pin
Jochen Arndt29-Nov-13 23:03
professionalJochen Arndt29-Nov-13 23:03 
GeneralRe: Visual C++ 2008 query Pin
Anthony Appleyard29-Nov-13 23:10
Anthony Appleyard29-Nov-13 23:10 
Questiondrawing butterfly network Pin
Member 1041597029-Nov-13 9:04
Member 1041597029-Nov-13 9:04 
AnswerRe: drawing butterfly network Pin
Richard Andrew x6429-Nov-13 15:01
professionalRichard Andrew x6429-Nov-13 15:01 
SuggestionRe: drawing butterfly network Pin
Richard MacCutchan29-Nov-13 22:37
mveRichard MacCutchan29-Nov-13 22:37 
QuestionCDialogbar's button tooltip can't show Pin
D.Manivelan29-Nov-13 2:16
D.Manivelan29-Nov-13 2:16 
SuggestionRe: CDialogbar's button tooltip can't show Pin
Richard MacCutchan29-Nov-13 6:07
mveRichard MacCutchan29-Nov-13 6:07 
QuestionMultiple dynamically created Spin Button Controls Pin
gokings27-Nov-13 11:37
gokings27-Nov-13 11:37 
Hello,

ENVIRONMENT: MFC

I seek help regarding the dynamic creation and use of Spin Button Controls.

Every example/tutorial I've found provides a lot of information, all of which I already know.

They all state the obvious, and avoid addressing the only non-obvious (at least to me) aspect.

When dealing with a statically created (or a single dynamically created) control, "up" and "down" messages are generally handled by a method of the spin button's parent window, having a prototype such as:

void Dlg::OnDeltaposSpinFoo(NMHDR* pNMHDR, LRESULT* pResult)
{
}


The NMHDR* parm can be type cast to an NMUPDOWN*, which provides data specific to a Spin Button Control.


The message map for the parent window contains an entry such as:

ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_ADJUST_FOO, OnDeltaposSpinFoo)


In such a case, it's obvious which spin control has been clicked, since the method is invoked for only a single control.

Suppose I want a range of ID's to be associated with OnDeltaposSpinFoo()?

Say I dynamically create a number of spin controls on a window, for which I wish to use a single message handler.

For some controls, such as buttons, there are "range" macros that may be placed in the message map.

How about for a spin button control?

If I could manage to have OnDeltaposSpinFoo() called for a range of ID's, I could identify the control by the idFrom member of the NMHDR parm (see structures below). I'd probably subtract a base value from the idFrom value to obtain an index to be used programmatically).

[
The relevant structures are:

typedef struct tagNMHDR {
  HWND     hwndFrom;
  UINT_PTR idFrom;
  UINT     code;
} NMHDR;

typedef struct _NM_UPDOWN {
  NMHDR hdr;
  int   iPos;
  int   iDelta;
} NMUPDOWN, *LPNMUPDOWN;

]

The bottom-line questions are:

1) How can I place an entry in the message map that will cause a "spin button prototype" function to be called (with an NMUPDOWN*) for a range of control ID's?

2) If that's not possible, how else can I handle the problem?



I'd appreciate suggestions.

Even more, I'd appreciate a working example project that will build and run using Visual Studio 2008 (I don't expect anyone to spend a lot of time creating one, but if you have one, or can quickly create one
from something you have....).

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.