|
Hi,
I want to show all the directory (directory structure)
in the Tree View
How can i do that
Sameer
|
|
|
|
|
CTreeCtrl::Expand
Use the root node as the HTREEITEM and TVE_EXPAND as the 2nd arg
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi,
I'am sory, but i guess u misunderstood my problem.
Actually i want to display a tree view in which all
the directories of the Drive are listed
Sameer
|
|
|
|
|
Sameer Maggon wrote:
Actually i want to display a tree view in which all
the directories of the Drive are listed
Sorry
What you need is SHBrowseForFolder
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
look at the foll,. article at Codeguru
http://www.codeguru.com/treeview/CDirTreeCtrl.shtml
|
|
|
|
|
Hi,
I saw that Control, but that control is too heavy.
I just want to Display the Directories and not the
Files etc.
Actually i just want to give a user, selection of a
Directory.
Please help
Sameer
|
|
|
|
|
You can limit the tree to one level.
Best regards,
Alexandru Savescu
|
|
|
|
|
Sameer Maggon wrote:
Actually i just want to give a user, selection of a
Directory.
Already told you. Use SHBrowseForFolder
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Use the foll. code
CString GetUserDirectory()
{
CString strPath ;
char szDisplayName[_MAX_PATH] ;
char *szPath = NULL ;
char *szTitle = _T(" Please Locate Directory : ") ;
BROWSEINFO bi = {0} ;
bi.pszDisplayName = &szDisplayName[0] ;
bi.lpszTitle = szTitle ;
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_RETURNFSANCESTORS ;
bi.hwndOwner = NULL ;
LPITEMIDLIST pidl = SHBrowseForFolder(&bi) ;
if( pidl == NULL )
return strPath ;
if( !SHGetPathFromIDList(pidl,szPath) )
{
AfxMessageBox(" The Path is Invalid ! ") ;
return strPath ;
}
IMalloc *pMalloc = NULL ;
HRESULT hr = SHGetMalloc(&pMalloc) ;
if( !SUCCEEDED(hr) )
return strPath ;
pMalloc->Free( (void*)pidl ) ;
pMalloc->Release() ;
strPath = szPath ;
return strPath ;
}
<pre>
|
|
|
|
|
Thanx for the code, but i had already written the application using MSDN.. Thanx a lot again for the help.
Regards
Sameer
|
|
|
|
|
Do I have to CoInitialize() and Uninitialize()
???
|
|
|
|
|
Thanx a lot Nish.
This solves my problem
|
|
|
|
|
See this article.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi,
All
I have a Server running which listens on a particular port and
according to the XML sent to it, it sends a JPG file (a binary stream).
Now this XML would be sent by my ASP page. I know i can do
this using ActiveX component.
Please suggest me (no code, just algo types) how to go about
it
Thanx
Sameer
|
|
|
|
|
Hi, How do I determine when the user has finished entering text in an edit box. In other words, how do I know he has pressed the enter key and has completed typing in the text.
Rui
|
|
|
|
|
Write a handler for EN_KILLFOCUS
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Sorry, I should have expressed myself better.
I know about Killfocus, but this requires that the user clicks elsewhere so that the focus on the edit box may be lost. Is there no other way?
Is there a way to call an event when the Enter key is pressed?
I tried using OnKeyDown, but am not sure how it works as I got no action from this event.
Rui
|
|
|
|
|
Hi,
You cannot trap enter from an edit box in the parent, you need to
derive a new class from CEdit and process the WM_CHAR mesgs
|
|
|
|
|
|
Haven't tried it now, but I think you can use PreTranslateMessage to get the WM_CHAR for the edit box, so you don't need to subclass it.
Another thing is, usually you have a default button in your dialog, so pressing enter will activate the default button, and the edit box gets an EN_KILLFOCUS message.
Martin
|
|
|
|
|
You wont get WM_KEYDOWN/WM_KEYUP messages in a dialog based application. I have written an article on how to go about trapping keys in dialog apps.
http://www.codeproject.com/useritems/pretransdialog01.asp
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Override the parents class PreTranslateMessage and put in this code:
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ENTER && GetFocus() == &m_Edit)
{
pMsg->wParam = VK_TAB ;
}
This code converts the ENTER key for that edit control only to a tab, so the EN_KILLFOCUS will be called regardless of whether the user uses the mouse, tab or enter key when ficnishing entering text.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Hi,
i'm looking for a simple example on how you can transport a class over a socket. I read somewhere that it involves serialization but i don't know how to do this exactly.
The only workaround i know of, is to serialize the class to file and then to transport the file. Transporting it directly is what i'm looking for and that involves streaming, right?
Preferably not in MFC but if it is, that's ok too
Thanks
|
|
|
|
|
Look up this topic on MSDN
"Windows Sockets: Using Sockets with Archives"
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
thanks for the link
if i recall correctly, didn't you write some articles that deal with socket programming?
do you have a link to socket programming with CArchive & mfc in other words, plain sockets and streams?
|
|
|
|