Click here to Skip to main content
15,892,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Simple Problem. How can I show an "Open file" dialog in a dialog-based App from MFC AppWizard Pin
andreir2328-Dec-03 15:20
andreir2328-Dec-03 15:20 
GeneralDialog problem Pin
Selevercin28-Dec-03 12:06
Selevercin28-Dec-03 12:06 
GeneralRe: Dialog problem Pin
User 58385228-Dec-03 14:08
User 58385228-Dec-03 14:08 
GeneralRe: Dialog problem Pin
Selevercin28-Dec-03 15:27
Selevercin28-Dec-03 15:27 
GeneralRe: Dialog problem Pin
User 58385228-Dec-03 15:36
User 58385228-Dec-03 15:36 
Generalcustom appwizard and images (Visual Studio 6.0) Pin
juthus28-Dec-03 10:32
juthus28-Dec-03 10:32 
GeneralCTreeCtrl and GetItem Problem Pin
User 1278228-Dec-03 9:33
User 1278228-Dec-03 9:33 
GeneralRe: CTreeCtrl and GetItem Problem Pin
PJ Arends28-Dec-03 15:53
professionalPJ Arends28-Dec-03 15:53 
Aaron Stubbendieck wrote:
When the selection of my tree control changes I would like to get the item icon index, I have this code:

NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
int iImage=pNMTreeView->itemNew.iImage;

However, the value of iImage is something like 1242756 or -86040328 (if I use a more indirect method). In fact, the entire NVITEM structure seems to have wrong values (the pszText member has jibberish).


According to MSDN, only the mask, hItem, state, and lParam members of TVITEM structure are valid. You should check the mask bits to ensure the member you want is valid before you try to accesss it.

That said, you can use CTreeCtrl::GetItemImage() to get the image from the hItem member of the TVITEM structure.
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
TVITEM tvnew = pNMTreeView->itemNew;
int iImage = 0;
if (tvnew.mask & TVIF_HANDLE == TVIF_HANDLE)   // make sure handle is valid
{
    int selimage;
    GetItemImage(tvnew.hItem, iImage, selimage);
}









Sonork 100.11743 Chicken Little

"You're obviously a superstar." - Christian Graus about me - 12 Feb '03

Within you lies the power for good - Use it!
GeneralRe: CTreeCtrl and GetItem Problem Pin
User 1278230-Dec-03 10:10
User 1278230-Dec-03 10:10 
Questionhow to add two projects Pin
auur28-Dec-03 8:01
auur28-Dec-03 8:01 
AnswerRe: how to add two projects Pin
Shanmuga Sundar28-Dec-03 16:47
Shanmuga Sundar28-Dec-03 16:47 
GeneralDisabling F1 Pin
Dominik Reichl28-Dec-03 7:41
Dominik Reichl28-Dec-03 7:41 
GeneralRe: Disabling F1 Pin
PJ Arends28-Dec-03 15:01
professionalPJ Arends28-Dec-03 15:01 
GeneralRe: Disabling F1 Pin
Dominik Reichl28-Dec-03 21:52
Dominik Reichl28-Dec-03 21:52 
GeneralRe: Disabling F1 Pin
Dominik Reichl28-Dec-03 21:53
Dominik Reichl28-Dec-03 21:53 
GeneralBuilding projects downloaded from this website Pin
Still learning how to code28-Dec-03 7:04
Still learning how to code28-Dec-03 7:04 
GeneralRe: Building projects downloaded from this website Pin
Michael Dunn28-Dec-03 7:09
sitebuilderMichael Dunn28-Dec-03 7:09 
GeneralHeight Pin
Rafael Fernández López28-Dec-03 3:17
Rafael Fernández López28-Dec-03 3:17 
GeneralRe: Height Pin
valikac28-Dec-03 7:38
valikac28-Dec-03 7:38 
GeneralRe: Height Pin
Rafael Fernández López28-Dec-03 13:45
Rafael Fernández López28-Dec-03 13:45 
Generalinstalling OpenCV library Pin
Anonymous28-Dec-03 3:11
Anonymous28-Dec-03 3:11 
Generalgenerating .obj files out of header files Pin
tguzella28-Dec-03 1:12
tguzella28-Dec-03 1:12 
GeneralRe: generating .obj files out of header files Pin
Gary R. Wheeler28-Dec-03 2:44
Gary R. Wheeler28-Dec-03 2:44 
QuestionHow to differentiate between 2 Slider Controls ?? Pin
elza28-Dec-03 0:06
elza28-Dec-03 0:06 
AnswerRe: How to differentiate between 2 Slider Controls ?? Pin
LunaticFringe28-Dec-03 0:29
LunaticFringe28-Dec-03 0:29 

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.