From: William on
Env: WindowsXP, VC+6.00, MFC

I need to add some processing just when up/down arrow is clicked.
From ClassWazard, the only message I can use is UDN_DELTAPOS.

Inside OnDeltaposSpin(), I need to know which button between up or down
arrow is clicked because I have to get the position after up or down arrow
is clicked(NOT the current position of a spin button control.

But I don't know how.

Please help.

TIA
William

From: David Ching on

"William" <port(a)mx15.freecom.ne.jp> wrote in message
news:%23kn$837lHHA.4848(a)TK2MSFTNGP05.phx.gbl...
> Env: WindowsXP, VC+6.00, MFC
>
> I need to add some processing just when up/down arrow is clicked.
> From ClassWazard, the only message I can use is UDN_DELTAPOS.
>
> Inside OnDeltaposSpin(), I need to know which button between up or down
> arrow is clicked because I have to get the position after up or down arrow
> is clicked(NOT the current position of a spin button control.
>

How about:

void CTrimWaveDlg::OnSpinDeltaPos(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;

if (pNMUpDown->iDelta > 0)
{
// Up button clicked
}
else
{
// Down button clicked
}
}


Note that due to the funky way Up/Down is defined, the logic above might
need to be reversed (some spin controls have up arrow increasing, and others
have it decreasing).

-- David


From: William on
Thanks David.

William

> How about:
>
> void CTrimWaveDlg::OnSpinDeltaPos(NMHDR* pNMHDR, LRESULT* pResult)
> {
> NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
>
> if (pNMUpDown->iDelta > 0)
> {
> // Up button clicked
> }
> else
> {
> // Down button clicked
> }
> }
>
>
> Note that due to the funky way Up/Down is defined, the logic above might
> need to be reversed (some spin controls have up arrow increasing, and
> others have it decreasing).
>
> -- David
>
>