small bug with List Control in vs 8

Hi all,

I'am using vs 8 beta 2.
Today, i made a very simple program with List Control. I did like that:
1) From vs 8, create a MFC program for pocket pc 2003 based Dialog.
2) In Dialog, using toolbox to add List Control to Dialog.
3) Now, you can choose the List control, click right -mouse to go to
properties page.
4) In Properties pae, choose tag controls events, go to LVN_ITEMACTIVE
then, click Add <...>
5) Now, vs 8 will help you automaticly to create a WM_NOTIFY each times
you active an items.
6) But look carefully to source code vs created:

void YourtestDlg::OnLvnItemActivateListTest(NMHDR *pNMHDR, LRESULT *pResult)

{

LPNMITEMACTIVATE pNMIA = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);

TODO: Add your control notification handler code here
*pResult = 0;

}

If you compile, you will meet an error withLPNMITEMACTIVATEcos it haven't been defined before.

So i look in the technical document,it say that we have to cast
pNMHDR to NMLISTVIEW, what do you think?

I tried to cast like that:
LPNMLISTVIEW pNMLV =reinterpret_cast<LPNMLISTVIEW>(pNMHDR);

With me, it work, i don't know if it makes some other bug or not.

Can you please cheek it, experts?

[1739 byte] By [JulienT] at [2007-12-16]
# 1
HI Julien,

Thanks for reporting this issue. I have noted this bug in our database. At this stage, I am not sure whether we will be able to fix this for this release but definitely for next one.

Thanks,
Dushiant

Dushiant at 2007-9-9 > top of Msdn Tech,Smart Device Development,Smart Devices Native C++ Development...
# 2

Hi Julien,

Indeed this is bug that the code genereted for OnLvnItemActivateList includes the code for desktop projects instead of device projects. As a work aroung you could use the following.

void CMFC1Dlg::OnLvnItemActivateListTest(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLISTVIEW lpnmlv = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);

// TODO: Add your control notification handler code here
*pResult = 0;
}

Unfortunately we could not fix this issue in the upcoming release for Visual studio 2005. However the documentation for this will cover the suggested workaround.
Hope this helps.

Thanks,
Gangadhar

Gangadhar_MSFT at 2007-9-9 > top of Msdn Tech,Smart Device Development,Smart Devices Native C++ Development...