Example #1
0
void CCJShellTree::OnFill(bool bRefresh/*=false*/)
{
    LPSHELLFOLDER lpsf=NULL;
    HRESULT hr;
    TV_SORTCB      tvscb;

	m_bRefresh = bRefresh;

    // Get a pointer to the desktop folder.
    hr=SHGetDesktopFolder(&lpsf);
	
    if (SUCCEEDED(hr))
    {
		// Initialize the tree view to be empty.
		DeleteAllItems();
		
		// Fill in the tree view from the root.
		FillTreeView(lpsf,
			NULL,
			TVI_ROOT);
		// Release the folder pointer.
		lpsf->Release();
    }
    tvscb.hParent     = TVI_ROOT;
    tvscb.lParam      = 0;
    tvscb.lpfnCompare = TreeViewCompareProc;
	
    // Sort the items in the tree view
	SortChildrenCB(&tvscb/*, FALSE*/);
	
	Expand(GetRootItem(), TVE_EXPAND);
}
Example #2
0
/****************************************************************************
*
*    FUNCTION: PopulateTree()
*
*    PURPOSE:  Processes the File.Fill/RefreshTree command
*
****************************************************************************/
void CShellTreeCtrl::PopulateTree() 
{

    LPSHELLFOLDER lpsf=NULL;
    LPITEMIDLIST  lpi=NULL;
    HRESULT hr;
    TV_SORTCB      tvscb;
   
    // Get a pointer to the desktop folder.
    hr=SHGetDesktopFolder(&lpsf);

    if (SUCCEEDED(hr))
    {
       // Initialize the tree view to be empty.
       DeleteAllItems();

       // Fill in the tree view from the root.
       FillTreeView(lpsf, NULL, TVI_ROOT);
       //TunnelFillTree(lpsf, NULL, TVI_ROOT);
       // Release the folder pointer.
       lpsf->Release();
    }
    tvscb.hParent     = TVI_ROOT;
    tvscb.lParam      = 0;
    tvscb.lpfnCompare = TreeViewCompareProc;

    // Sort the items in the tree view
	SortChildrenCB(&tvscb/*, FALSE*/);
    
	HTREEITEM hItem;
	hItem = GetRootItem();
	Expand(hItem,TVE_EXPAND);
	Select(GetRootItem(),TVGN_CARET);
}
Example #3
0
static LRESULT BrsFolder_Treeview_Expand( browse_info *info, NMTREEVIEWW *pnmtv )
{
    IShellFolder *lpsf2 = NULL;
    LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA) pnmtv->itemNew.lParam;
    HRESULT r;

    TRACE("TVN_ITEMEXPANDINGA/W\n");

    if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE))
        return 0;

    if (lptvid->lpi && lptvid->lpi->mkid.cb) {
        r = IShellFolder_BindToObject( lptvid->lpsfParent, lptvid->lpi, 0,
                                      (REFIID)&IID_IShellFolder, (LPVOID *)&lpsf2 );
    } else {
        lpsf2 = lptvid->lpsfParent;
        r = IShellFolder_AddRef(lpsf2);
    }

    if (SUCCEEDED(r))
        FillTreeView( info, lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem, lptvid->pEnumIL);

    /* My Computer is already sorted and trying to do a simple text
     * sort will only mess things up */
    if (!_ILIsMyComputer(lptvid->lpi))
        SendMessageW( info->hwndTreeView, TVM_SORTCHILDREN,
                      FALSE, (LPARAM)pnmtv->itemNew.hItem );

    return 0;
}
Example #4
0
BOOL CMainFrame::OnIdle()
{
	UIUpdateToolBar();

	//
	if (_canvas)
	{
		_canvas->update();
		_canvas->render();
	}
	//
	static bool sFirst = true;
	if (sFirst)
	{
		sFirst = false;
		CComPtr<IShellFolder> spFolder;
		HRESULT hr = ::SHGetDesktopFolder(&spFolder);
		if(SUCCEEDED(hr))
		{
			CWaitCursor wait;

			FillTreeView(spFolder, NULL, TVI_ROOT);
			m_wndTreeView.Expand(m_wndTreeView.GetRootItem());
			m_wndTreeView.SelectItem(m_wndTreeView.GetRootItem());
		}
	}

	return FALSE;
}
Example #5
0
/****************************************************************************
*
*	FUNCTION:	OnFolderSelected(NMHDR* pNMHDR, LRESULT* pResult, CString &szFolderPath) 
*
*	PURPOSE:	Call this function if for example you want to put the path of the folder
*				selected inside a combobox or an edit window. You would pass the
*				parameters from OnSelChanged() to this function along with a CString object
*				that will hold the folder path. If the path is not
*				in the filesystem(eg MyComputer) it returns false.
*
*	MESSAGEMAP:	TVN_SELCHANGED
*
****************************************************************************/
BOOL CShellTreeCtrl::OnFolderSelected(NMHDR* pNMHDR, LRESULT* pResult, CString &szFolderPath) 
{
	// TODO: Add your control notification handler code here
	LPTVITEMDATA	lptvid;  //Long pointer to TreeView item data
	LPSHELLFOLDER	lpsf2=NULL;
	static char		szBuff[MAX_PATH];
	HRESULT			hr;
	BOOL			bRet=false;
	TV_SORTCB		tvscb;
	HTREEITEM		hItem=NULL;

	if((hItem = GetSelectedItem()))
	{
		lptvid=(LPTVITEMDATA)GetItemData(hItem);

		if (lptvid && lptvid->lpsfParent && lptvid->lpi)
		{
			hr=lptvid->lpsfParent->BindToObject(lptvid->lpi,
					 0,IID_IShellFolder,(LPVOID *)&lpsf2);

			if (SUCCEEDED(hr))
				{
					ULONG ulAttrs = SFGAO_FILESYSTEM;

					// Determine what type of object we have.
					lptvid->lpsfParent->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs);

					if (ulAttrs & (SFGAO_FILESYSTEM))
					{
						if(SHGetPathFromIDList(lptvid->lpifq,szBuff)){
							szFolderPath = szBuff;
							bRet = true;
						}
					}
					//non standard from here(NEW CODE)
					NM_TREEVIEW* pnmtv = (NM_TREEVIEW*)pNMHDR;
					if ((pnmtv->itemNew.cChildren == 1) && !(pnmtv->itemNew.state & TVIS_EXPANDEDONCE)){
						FillTreeView(lpsf2,lptvid->lpifq,pnmtv->itemNew.hItem);

						tvscb.hParent     = pnmtv->itemNew.hItem;
						tvscb.lParam      = 0;
						tvscb.lpfnCompare = TreeViewCompareProc;
						SortChildrenCB(&tvscb);
						
						pnmtv->itemNew.state |= TVIS_EXPANDEDONCE;
						pnmtv->itemNew.stateMask |= TVIS_EXPANDEDONCE;
						pnmtv->itemNew.mask |= TVIF_STATE;
						SetItem(&pnmtv->itemNew);
					}
				}

		}
		if(lpsf2)
			lpsf2->Release();
		
	}	
	*pResult = 0;
	return bRet;
}
Example #6
0
void CFunctionPage::FillTreeView()
{
	MessageStruct* pMes = CMessageManager::m_sHandlerManager.GetRootMessage();
	ATLASSERT(pMes);
	if (!pMes)
		return;
	FillTreeView(NULL, pMes);
}
Example #7
0
void CFunctionPage::FillTreeView(HTREEITEM hRootItem, MessageStruct* pMes)
{
	if ((int)_AtlModule.m_eWTLVersion < eWTL75 && pMes->Type & REFLECTION_MESSAGE)
		return;

	TVITEM* tvi;
	TVINSERTSTRUCT tvis;
	ZeroMemory(&tvis, sizeof(tvis));
	tvi = &tvis.item;
	tvi->mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
	tvi->lParam = (LPARAM)pMes;
	CString Name = pMes->Message;

	LPTSTR pName = Name.LockBuffer();
	tvi->pszText = pName;
	tvi->cchTextMax = Name.GetLength() + 1;
	int Type = pMes->Type & TYPE_MASK;
	if (pMes->IconIndex == -1)
	{
		if (Type == ROOT_PLACE)
		{
			tvi->iImage = 0;
			tvi->iSelectedImage = 0;
		}
		else
		{
			tvi->iImage = 2;
			tvi->iSelectedImage = 2;
		}
	}
	else
	{
		tvi->iSelectedImage = tvi->iImage = pMes->IconIndex;
	}
	tvi->cChildren = 0;
	tvis.hParent = hRootItem;
	int Flags = pMes->Type & FLAGS_MASK;
	if (Flags & CUSTOM_MESSAGE)
	{
		tvis.hInsertAfter = TVI_LAST;
	}
	else
	{
		tvis.hInsertAfter = TVI_SORT;
	}
	HTREEITEM NewItem = m_Messages.InsertItem(&tvis);
	Name.UnlockBuffer();

	if (Type == ROOT_PLACE)
	{
		for (size_t i = 0; i < pMes->Children.GetCount(); i++)
		{
			FillTreeView(NewItem, pMes->Children[i]);
		}
	}
}
Example #8
0
void Sample_Init ( void ) // All added init code
{
   RECT rc;

   InitCommonControls();  // This MUST be called once per instance
                          // to register the TreeView class.

   hCoasterImageList = ImageList_Create
                         (
                         32, 32,
                         TRUE,
                         5,
                         1
                         );

   iImageWood   = ImageList_AddIcon ( hCoasterImageList, LoadIcon ( hInst, "WOOD"   ));
   iImageSteel  = ImageList_AddIcon ( hCoasterImageList, LoadIcon ( hInst, "STEEL"  ));
   iImageOH     = ImageList_AddIcon ( hCoasterImageList, LoadIcon ( hInst, "OH"     ));
   iImageNY     = ImageList_AddIcon ( hCoasterImageList, LoadIcon ( hInst, "NY"     ));
   iImageCA     = ImageList_AddIcon ( hCoasterImageList, LoadIcon ( hInst, "CA"     ));
   iImageOH_OPEN= ImageList_AddIcon ( hCoasterImageList, LoadIcon ( hInst, "OH_OPEN"));
   iImageNY_OPEN= ImageList_AddIcon ( hCoasterImageList, LoadIcon ( hInst, "NY_OPEN"));
   iImageCA_OPEN= ImageList_AddIcon ( hCoasterImageList, LoadIcon ( hInst, "CA_OPEN"));

   iImageRider1 = ImageList_AddIcon ( hCoasterImageList, LoadIcon ( hInst, "RIDER1" ));
   iImageRider2 = ImageList_AddIcon ( hCoasterImageList, LoadIcon ( hInst, "RIDER2" ));

   GetClientRect ( ghWnd, &rc );

   hWndTreeView = CreateWindow ( WC_TREEVIEW,
                                 "",
                                 WS_VISIBLE | WS_CHILD | WS_BORDER |
                                 TVS_HASLINES | TVS_EDITLABELS,
                                 0, 0,
                                 rc.right, rc.bottom,
                                 ghWnd,
                                 (HMENU)NULL,
                                 hInst,
                                 NULL
                               );

   if (hWndTreeView)
     {
     TreeView_SetImageList ( hWndTreeView, hCoasterImageList, 0 );
     ImageList_SetBkColor  ( hCoasterImageList, GetSysColor ( COLOR_WINDOW ));
     FillTreeView ( hWndTreeView );
     }
}
Example #9
0
//响应浏览器控件操作(在WM_NOTIFY消息中调用)
UINT Response_Browser(LONG lParam)
{
   NM_TREEVIEW *pnmtv = (NM_TREEVIEW *)lParam;
   LPTVITEMDATA lptvid ;
   HRESULT hr ;
   LPSHELLFOLDER lpsf2 = 0 ;

   switch( pnmtv -> hdr.code)
	{
		case TVN_SELCHANGED:
			lptvid = (LPTVITEMDATA)pnmtv -> itemNew.lParam;
         GetName(lptvid -> lpsfParent, lptvid->lpi, SHGDN_FORPARSING, szFoldername);

         if(szFoldername[1]!=':' || szFoldername[2]!='\\')
			{
		   	GetWindowsDirectory(szFoldername,MAX_PATH);
  				strcat(szFoldername,"\\desktop\0");
            TreeView_SelectItem(hTreeWnd,TreeView_GetRoot(hTreeWnd));
		   }
			return TVN_SELCHANGED;

		case TVN_ITEMEXPANDING:
		   if(( pnmtv -> itemNew.state & TVIS_EXPANDEDONCE))
				break ;

		   lptvid = (LPTVITEMDATA)pnmtv -> itemNew.lParam ;
		   hr=lptvid -> lpsfParent->BindToObject(lptvid -> lpi,
																   0,
																   IID_IShellFolder,
																   (LPVOID *)&lpsf2) ;

		   if( SUCCEEDED(hr))
		   {
			  FillTreeView(hTreeWnd,
								   lpsf2,
								   lptvid -> lpifq,
								   pnmtv -> itemNew.hItem) ;
		   }

		   TreeView_SortChildren(hTreeWnd, pnmtv -> itemNew.hItem, FALSE) ;
			return FALSE;//TVN_ITEMEXPANDING;

		default:
		   break;
   }
   return FALSE;
}
Example #10
0
//-----------------------------------------------------------------------------
// OnInitDialog()
//-----------------------------------------------------------------------------
void OnInitDialog(HWND w)
{
	TRACE((TRACE_ENTER,_F_, ""));
	
	int cx;
	int cy;
	RECT rect;
	
	gwLaunchApp=w;

	// Positionnement et dimensionnement de la fenêtre
	if (gx2!=-1 && gy2!=-1 && gcx2!=-1 && gcy2!=-1)
	{
		SetWindowPos(w,NULL,gx2,gy2,gcx2,gcy2,SWP_NOZORDER);
	}
	else // position par défaut
	{
		cx = GetSystemMetrics( SM_CXSCREEN );
		cy = GetSystemMetrics( SM_CYSCREEN );
		GetWindowRect(w,&rect);
		SetWindowPos(w,NULL,cx-(rect.right-rect.left)-50,cy-(rect.bottom-rect.top)-70,0,0,SWP_NOSIZE | SWP_NOZORDER);
	}

	// icone ALT-TAB
	SendMessage(w,WM_SETICON,ICON_BIG,(LPARAM)ghIconAltTab); 
	SendMessage(w,WM_SETICON,ICON_SMALL,(LPARAM)ghIconSystrayActive); 
	
	// Chargement de l'image list
	TreeView_SetImageList(GetDlgItem(w,TV_APPLICATIONS),ghImageList,TVSIL_STATE);

	// Remplissage de la treeview
	FillTreeView(w);

	// case à cocher "Toujours visible"
	CheckDlgButton(w,CK_VISIBLE,gbLaunchTopMost?BST_CHECKED:BST_UNCHECKED);
	SetWindowPos(w,gbLaunchTopMost?HWND_TOPMOST:HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);

	// timer de refresh
	if (giSetForegroundTimer==giTimer) giSetForegroundTimer=21;
	SetTimer(w,giSetForegroundTimer,100,NULL);

	TRACE((TRACE_LEAVE,_F_, ""));
}
Example #11
0
/****************************************************************************
*
*	FUNCTION:	OnFolderExpanding(NMHDR* pNMHDR, LRESULT* pResult) 
*
*	PURPOSE:	Reponds to an TVN_ITEMEXPANDING message in order to fill up
*				subdirectories. Pass the parameters from OnItemExpanding() to 
*				this function. You need to do that or your folders won't
*				expand.
*
*	OTHER:		It can also be used to update a corresponding listview. Seem MFCENUM
*
*	MESSAGEMAP:	TVN_ITEMEXPANDING
*
****************************************************************************/
void CShellTreeCtrl::OnFolderExpanding(NMHDR* pNMHDR, LRESULT* pResult) 
{
	LPTVITEMDATA   lptvid;  //Long pointer to TreeView item data
	HRESULT        hr;
	LPSHELLFOLDER  lpsf2=NULL;
	static char    szBuff[MAX_PATH];
	TV_SORTCB      tvscb;

	NM_TREEVIEW* pnmtv = (NM_TREEVIEW*)pNMHDR;
	// TODO: Add your control notification handler code here
    if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE))
	{
         return;
	}

    lptvid=(LPTVITEMDATA)pnmtv->itemNew.lParam;
    if (lptvid)
       {
            hr=lptvid->lpsfParent->BindToObject(lptvid->lpi,
                0, IID_IShellFolder,(LPVOID *)&lpsf2);

            if (SUCCEEDED(hr))
            {
                FillTreeView(lpsf2,
                       lptvid->lpifq,
                       pnmtv->itemNew.hItem);
            }

            tvscb.hParent     = pnmtv->itemNew.hItem;
            tvscb.lParam      = 0;
            tvscb.lpfnCompare = TreeViewCompareProc;

            SortChildrenCB(&tvscb /*, FALSE*/);
    }	
	

	*pResult = 0;
}
Example #12
0
//初始化浏览器控件(nID为资源文件中树型控件的id)
BOOL Init_Browser(HWND hWnd,UINT nID)
{
	HIMAGELIST hImageList;
   LPSHELLFOLDER lpsf = 0 ;
   SHFILEINFO    sfi;
	HRESULT hr ;
	BOOL bOK;

	memset(szFoldername,0,MAX_PATH);
   hTreeWnd=GetDlgItem(hWnd,nID);

   hImageList = (HIMAGELIST)SHGetFileInfo((LPCSTR)"C:\\",
                                           0,
                                           &sfi,
                                           sizeof(SHFILEINFO),
                                           SHGFI_SYSICONINDEX | SHGFI_SMALLICON) ;

  	if(hImageList)
   	TreeView_SetImageList(hTreeWnd,hImageList,0);

	hr=SHGetDesktopFolder(&lpsf) ;

	if( SUCCEEDED(hr))
	{
	   TreeView_DeleteAllItems(hTreeWnd);
	   FillTreeView(hTreeWnd,lpsf,NULL,TVI_ROOT) ;
      ExpandTree();
      TreeView_SelectItem(hTreeWnd,TreeView_GetRoot(hTreeWnd));//,TVGN_FIRSTVISIBLE);
      bOK = TRUE;
	}
   else
   	bOK = FALSE;

	if(lpsf)
		lpsf->Release();
	return bOK;
}
/* #FN#
   Reponds to TVN_ITEMEXPANDING message in order to fill up subdirectories.
   Pass the parameters from OnItemExpanding() to this function. You need to
   do that or your folders won't expand */
void
/* #AS#
   Nothing */
CShellTree::
OnFolderExpanding(
	NMHDR   *pNMHDR, /* #IN# */
	LRESULT *pResult /* #OUT# */
)
{
	LPTVITEMDATA  lptvid; /* Long pointer to TreeView item data */
	LPSHELLFOLDER lpsf2 = NULL;
	TV_SORTCB     tvscb;
	static char   szBuff[ MAX_PATH + 1 ];
	HRESULT       hr;

	NM_TREEVIEW *pnmtv = (NM_TREEVIEW *)pNMHDR;

	if( pnmtv->itemNew.state & TVIS_EXPANDEDONCE )
		return;

	lptvid = (LPTVITEMDATA)pnmtv->itemNew.lParam;
	if( lptvid )
	{
		hr = lptvid->lpsfParent->BindToObject( lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2 );
		
		if( SUCCEEDED(hr) )
			FillTreeView( lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem );

		tvscb.hParent     = pnmtv->itemNew.hItem;
		tvscb.lParam      = 0;
		tvscb.lpfnCompare = TreeViewCompareProc;
		
		SortChildrenCB( &tvscb /*, FALSE*/ );
	}
	*pResult = 0;

} /* #OF# CShellTree::OnFolderExpanding */
/* #FN#
   Populates the tree view control with file list */
void
/* #AS#
   Nothing */
CShellTree::
PopulateTree()
{
	LPSHELLFOLDER lpsf = NULL;
	LPITEMIDLIST  lpi  = NULL;
	HRESULT hr;

	/* Get a pointer to the desktop folder */
	hr = SHGetDesktopFolder( &lpsf );

	if( SUCCEEDED(hr) )
	{
		/* Initialize the tree view to be empty */
		DeleteAllItems();

		/* Fill in the tree view from the root */
		FillTreeView( lpsf, NULL, TVI_ROOT );
		/* Release the folder pointer */
		lpsf->Release();
	}
	TV_SORTCB tvscb;
	tvscb.hParent     = TVI_ROOT;
	tvscb.lParam      = 0;
	tvscb.lpfnCompare = TreeViewCompareProc;

	/* Sort the items in the tree view */
	SortChildrenCB( &tvscb /*, FALSE*/ );

	HTREEITEM hItem = GetRootItem();
	Expand( hItem, TVE_EXPAND );
	Select( GetRootItem(), TVGN_CARET );

} /* #OF# CShellTree::PopulateTree */
Example #15
0
void CCJShellTree::OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
	*pResult = 0;

	LPTVITEMDATA   lptvid;  //Long pointer to TreeView item data
	HRESULT        hr;
	LPSHELLFOLDER  lpsf2=NULL;
	static char    szBuff[MAX_PATH];
	TV_SORTCB      tvscb;

	if ((pNMTreeView->itemNew.state & TVIS_EXPANDEDONCE))
		return;
	
	SetRedraw(FALSE);
	lptvid=(LPTVITEMDATA)pNMTreeView->itemNew.lParam;
	if (lptvid)
	{
		hr=lptvid->lpsfParent->BindToObject(lptvid->lpi,
			0, IID_IShellFolder,(LPVOID *)&lpsf2);
		
		if (SUCCEEDED(hr))
		{
			FillTreeView(lpsf2,
				lptvid->lpifq,
				pNMTreeView->itemNew.hItem);
		}
		
		tvscb.hParent     = pNMTreeView->itemNew.hItem;
		tvscb.lParam      = 0;
		tvscb.lpfnCompare = TreeViewCompareProc;
		
		SortChildrenCB(&tvscb/*, FALSE*/);
	}
	SetRedraw();
}
Example #16
0
//-----------------------------------------------------------------------------
// LaunchAppDialogProc()
//-----------------------------------------------------------------------------
// DialogProc de la fenêtre de lancement d'application 
//-----------------------------------------------------------------------------
static int CALLBACK LaunchAppDialogProc(HWND w,UINT msg,WPARAM wp,LPARAM lp)
{
	UNREFERENCED_PARAMETER(lp);
//	TRACE((TRACE_DEBUG,_F_,"msg=0x%08lx LOWORD(wp)=0x%04x HIWORD(wp)=%d lp=%d",msg,LOWORD(wp),HIWORD(wp),lp));
	CheckIfQuitMessage(msg);
	int rc=FALSE;
	switch (msg)
	{
		case WM_INITDIALOG:		// ------------------------------------------------------- WM_INITDIALOG
			OnInitDialog(w);
			MoveControls(w); 
			break;
		case WM_DESTROY:
			//
			break;
		case WM_HELP:
			Help();
			break;
		case WM_TIMER:
			TRACE((TRACE_INFO,_F_,"WM_TIMER (SetForeground)"));
			if (giSetForegroundTimer==(int)wp) 
			{ 
				KillTimer(w,giSetForegroundTimer);
				SetForegroundWindow(w); 
				SetFocus(w); 
			}
			break;
		case WM_COMMAND:		// ------------------------------------------------------- WM_COMMAND
			//TRACE((TRACE_DEBUG,_F_,"WM_COMMAND LOWORD(wp)=0x%04x HIWORD(wp)=%d lp=%d",LOWORD(wp),HIWORD(wp),lp));
			switch (LOWORD(wp))
			{
				case IDOK:
					if (HIWORD(wp)==0) // les notifications autres que "from a control" ne nous intéressent pas !
					{
						LaunchSelectedApp(w);
					}
					break;
				case IDCANCEL:
					if (HIWORD(wp)==0) // les notifications autres que "from a control" ne nous intéressent pas !
					{
						SaveWindowPos(w);
						EndDialog(w,IDCANCEL);
					}
					break;
				case CK_VISIBLE:
					gbLaunchTopMost=(IsDlgButtonChecked(w,CK_VISIBLE)==BST_CHECKED);
					SetWindowPos(w,gbLaunchTopMost?HWND_TOPMOST:HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
					break;
			}
			break;
		case WM_SIZE:			// ------------------------------------------------------- WM_SIZE
			MoveControls(w); 
			break;
		case WM_NOTIFY:			// ------------------------------------------------------- WM_NOTIFY
			switch (((NMHDR FAR *)lp)->code) 
			{
				case NM_DBLCLK:
					if (wp==TV_APPLICATIONS) 
					{
						LaunchSelectedApp(w);
					}
					break;
				case TVN_KEYDOWN:
					{
						LPNMTVKEYDOWN ptvkd = (LPNMTVKEYDOWN)lp;
						switch (ptvkd->wVKey)
						{
							case VK_F5:
								FillTreeView(w);
								break;
						}
					}
					break;
			}
			break;
	}
	return rc;
}
Example #17
0
LRESULT CFunctionPage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	bHandled = TRUE;
	START_PROFILE(FuncInit);
	m_MessageMaps.Attach(GetDlgItem(IDC_COMBO_MESSAGEMAP));
	m_MessageManager.Init(m_hWnd, m_pResManager, &m_GeneralResources);
	m_FunctionManager.Init(m_hWnd);

	CreateControls();

	CImageList ImageList;
	ImageList.Create(16, 16, ILC_COLOR24 | ILC_MASK, 3, 2);
	ImageList.AddIcon(LoadIcon(_AtlModule.GetResourceInstance(), MAKEINTRESOURCE(IDI_ICON_CLOSE)));
	ImageList.AddIcon(LoadIcon(_AtlModule.GetResourceInstance(), MAKEINTRESOURCE(IDI_ICON_OPEN)));
	ImageList.AddIcon(LoadIcon(_AtlModule.GetResourceInstance(), MAKEINTRESOURCE(IDI_ICON_MESSAGE)));
	ImageList.Add(LoadBitmap(_AtlModule.GetResourceInstance(), MAKEINTRESOURCE(IDB_BITMAP_ICONS)), 0x7C00FF);

	m_Messages.SetImageList(ImageList.Detach(), TVSIL_NORMAL);
	FillTreeView();

	//построение дерева
	HTREEITEM hRoot = m_Messages.GetRootItem();
	m_Messages.Expand(hRoot);
	HTREEITEM hRootChild = m_Messages.GetChildItem(hRoot);
	while(hRootChild)
	{
		m_Messages.Expand(hRootChild);
		hRootChild = m_Messages.GetNextSiblingItem(hRootChild);
	}

	CRect r;
	m_Handlers.GetWindowRect(r);
	int width = m_WindowSettings.m_HandlerHeaderWidth; //(r.Width() * 5) / 11;
	m_Handlers.InsertColumn(0, _T("Handler"), LVCFMT_LEFT, width, 0);
	m_Handlers.InsertColumn(1, _T("Message"), LVCFMT_LEFT, r.Width() - width-5, 1);
	m_Handlers.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);

	if (m_pClassVector->GetCount())
	{
		int iCurClass = 0;
		for (size_t i = 0; i < m_pClassVector->GetCount(); i++)
		{
			int iPos = m_ClassCombo.AddString((*m_pClassVector)[i]->Name);
			m_ClassCombo.SetItemData(iPos, i);
			if (i == *m_piCurrentClass)
				iCurClass = iPos;
		}
		m_ClassCombo.SetCurSel(iCurClass);
		UpdateClass();
	}

	LoadGeneralResources();
	m_ToolbarImgList.CreateFromImage(IDB_BITMAP_MESSAGE, 18, 6, RGB(197, 200,201), IMAGE_BITMAP, LR_CREATEDIBSECTION);
	InitToolTip();
	m_ToolTip.SetMaxTipWidth(400);
	if ((int)_AtlModule.m_eWTLVersion < eWTL75)
	{
		GetDlgItem(IDC_CHECK_REFLECT_EX).ShowWindow(SW_HIDE);
	}

	m_SplitMessages.SetFocus();
	END_PROFILE(FuncInit, _T("CFunctionPage::OnInitDialog"));
	return 0;
}
Example #18
0
void CCJShellTree::PopulateTree(LPCTSTR lpszPath)
{
	LPSHELLFOLDER lpsf=NULL,lpsf2=NULL;
    LPITEMIDLIST  lpi=NULL;
    HRESULT hr;
    TV_SORTCB      tvscb;
	LPTSTR			lpFolder = (LPTSTR)lpszPath;
	LPTSTR			lpNextFolder;
	TCHAR			strPath[_MAX_PATH];
	
	LPMALLOC pMalloc;
	if (::SHGetMalloc(&pMalloc) == NOERROR)
	{
		
		// Get a pointer to the desktop folder.
		hr=SHGetDesktopFolder(&lpsf);
		
		if (SUCCEEDED(hr))
		{
			USES_CONVERSION;
			
			// Initialize the tree view to be empty.
			DeleteAllItems();
			
			do{
				
				// Get the Next Component
				lpNextFolder = PathFindNextComponent( lpFolder );
				if( lpNextFolder && *lpNextFolder ){
					memcpy( strPath, lpFolder, ( lpNextFolder - lpFolder ) );
					strPath[lpNextFolder - lpFolder] = _T('\0');
				}
				else{
					_tcscpy( strPath, lpFolder );
					lpNextFolder = NULL;
				}
				
				// Get ShellFolder Pidl
				ULONG eaten;
				hr = lpsf->ParseDisplayName( NULL, NULL, T2OLE(strPath), &eaten, &lpi, NULL );
				if( FAILED( hr ) ){
					break;
				}
				hr=lpsf->BindToObject(lpi, 0, IID_IShellFolder,(LPVOID *)&lpsf2);
				if( FAILED( hr ) ){
					break;
				}
				
				pMalloc->Free( lpi );
				
				// Release the Parent Folder pointer.
				lpsf->Release();
				
				// Chenge Folder Info
				lpsf = lpsf2;
				lpFolder = lpNextFolder;
			}
			while( lpNextFolder );
			
			FillTreeView(lpsf,NULL,TVI_ROOT);
			
		}
	}
    tvscb.hParent     = TVI_ROOT;
    tvscb.lParam      = 0;
    tvscb.lpfnCompare = TreeViewCompareProc;
	
    // Sort the items in the tree view
	SortChildrenCB(&tvscb/*, FALSE*/);
    
	HTREEITEM hItem;
	hItem = GetRootItem();
	Expand(hItem,TVE_EXPAND);
	Select(GetRootItem(),TVGN_CARET);
}