Click here to Skip to main content
15,888,984 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalidentifying disk drives and media type Pin
Chintoo72318-Aug-05 7:14
Chintoo72318-Aug-05 7:14 
GeneralRe: identifying disk drives and media type Pin
Ravi Bhavnani18-Aug-05 7:35
professionalRavi Bhavnani18-Aug-05 7:35 
GeneralRe: identifying disk drives and media type Pin
Chintoo72318-Aug-05 7:56
Chintoo72318-Aug-05 7:56 
GeneralRe: identifying disk drives and media type Pin
Ravi Bhavnani18-Aug-05 8:13
professionalRavi Bhavnani18-Aug-05 8:13 
GeneralRe: identifying disk drives and media type Pin
Chintoo72318-Aug-05 8:44
Chintoo72318-Aug-05 8:44 
GeneralOpenGL Pin
Dennis L18-Aug-05 7:10
Dennis L18-Aug-05 7:10 
GeneralRe: OpenGL Pin
johnny18218-Aug-05 12:32
johnny18218-Aug-05 12:32 
GeneralHelp with SetItemData/GetItemData of CTreeCtrl Pin
johnnyXP18-Aug-05 6:43
johnnyXP18-Aug-05 6:43 
I have a dialog based class named CJKDlg, with a tree control with name treeTracks.
In the JKDlg.h i have defined the following structure:

struct _itemData
{
	CString strData;
};


In the OK click event i have the following handler:

void CJKDlg::OnBnClickedOk()
{
	CStdioFile stdFile;
	CString str;
	
	if(! stdFile.Open("test.txt", CFile::modeRead))
	{
		AfxMessageBox("Cannot find initialization file", MB_OK, MB_ICONSTOP);
		return;
	}

	TVINSERTSTRUCT tvInsert;
	tvInsert.hParent = NULL;
	tvInsert.hInsertAfter = NULL;
	tvInsert.item.mask = TVIF_TEXT;

	HTREEITEM hAlbum, hItem;
	char ch;
	CString albumTitle, trackTitle, trackPath;
	_itemData* pItemData = new _itemData();

	while(stdFile.ReadString(str))
	{
		ch = str.GetAt(0);
		if(ch=='$')
		{
			albumTitle = str.Right(str.GetLength()-1);
			//TRACE1("%s\n", albumTitle);
			tvInsert.item.pszText = albumTitle.GetBuffer(albumTitle.GetLength());
			hAlbum = m_treeTracks.InsertItem(&tvInsert);
			pItemData->strData = "OK";
			m_treeTracks.SetItemData(hAlbum, DWORD(pItemData));
		}
	}

	delete pItemData;

}


In last a double-click event handler for the tree control:

void CJKDlg::OnNMDblclkTreeTracks(NMHDR *pNMHDR, LRESULT *pResult)
{
	HTREEITEM hItem = m_treeTracks.GetSelectedItem();
	ASSERT(hItem);
	_itemData* pItemData  = new _itemData();
	pItemData = (_itemData *)m_treeTracks.GetItemData(hItem); 
	
	if(pItemData)
	{
             TRACE1("%s\n", pItemData->strData);
	}
	
	delete pItemData;
	*pResult = 0;
}


The TRACE macro dose not display the "OK" string. Instead in the output window a white space displayed.
Can anyone help me with this please?
GeneralRe: Help with SetItemData/GetItemData of CTreeCtrl Pin
David Crow18-Aug-05 7:57
David Crow18-Aug-05 7:57 
GeneralRe: Help with SetItemData/GetItemData of CTreeCtrl Pin
Anonymous18-Aug-05 9:11
Anonymous18-Aug-05 9:11 
GeneralPrinting my Custom Control Pin
AnTri18-Aug-05 5:55
AnTri18-Aug-05 5:55 
Generaldraw in internet explorer Pin
Member 203712118-Aug-05 5:46
Member 203712118-Aug-05 5:46 
GeneralChecking if region only contains background color Pin
skonopa18-Aug-05 4:46
skonopa18-Aug-05 4:46 
Generalprinting Pin
mikobi18-Aug-05 4:27
mikobi18-Aug-05 4:27 
GeneralRe: printing Pin
David Crow18-Aug-05 5:19
David Crow18-Aug-05 5:19 
GeneralRe: printing Pin
mikobi18-Aug-05 5:54
mikobi18-Aug-05 5:54 
GeneralRe: printing Pin
David Crow18-Aug-05 6:15
David Crow18-Aug-05 6:15 
GeneralRe: printing Pin
mikobi18-Aug-05 21:06
mikobi18-Aug-05 21:06 
GeneralRe: printing Pin
mikobi18-Aug-05 21:07
mikobi18-Aug-05 21:07 
GeneralRe: printing Pin
mikobi18-Aug-05 21:09
mikobi18-Aug-05 21:09 
GeneralRe: printing Pin
David Crow19-Aug-05 2:13
David Crow19-Aug-05 2:13 
GeneralRe: printing Pin
mikobi19-Aug-05 6:13
mikobi19-Aug-05 6:13 
Generalbuild gui by using vc++ 6.0 Pin
meiyueh18-Aug-05 3:41
meiyueh18-Aug-05 3:41 
GeneralRe: build gui by using vc++ 6.0 Pin
Trollslayer18-Aug-05 4:30
mentorTrollslayer18-Aug-05 4:30 
GeneralRe: build gui by using vc++ 6.0 Pin
David Crow18-Aug-05 5:32
David Crow18-Aug-05 5:32 

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.