September 15th, 2003, 04:53 PM
VC++ Browse (long)
Okay here is my question.
whenever you desire to download a file from the internet, you have to choose a location to save to. It usually says:
Save; then in a combobox it says; desktop
then below that you have a bunch of choices like:
My Network Places
and so on. When you double click on one of these choices you go to the next level.
Ex. if you double clicked on "My Computer" you have
3 1/2 Floppy (A:)
and so on. I want this to be my main screen. I would like to just have this window in my VC++ 5.0 application. Could you guide me in writing the code for this. I have already created the template. The little bit of code that I have has come from a tutorial. Here is the code
The first function enables the drop down menu. It gives me 4 choices. I would like to to just start on the desktop.
The next function, if I understand correctly, is the filler where you have your bunch of choices. The tutorial made it so that there are 27 catagories. I would like it to just show the different directories that are available.
//TODO: add you control notification handler code here
//retrieve the index of the seleted item
int nIndex = m_cbMainDir.GetCurSel();
//check the index is valid
if (nIndex != CB_ERR)
//get the text of the selected item and store in a member variable and call functions
//to populate the other controls
//remove all existing tree items
//Allocate an array of HTREEITEMS
//insert items 'A' through 'Z' as root items
for (int nChar = 'A';nChar<='Z';nChar++)
hLetter[nChar - 'A'] = m_treeFiles.InsertItem((TCHAR*)&nChar);
//Insert 'Other' item as a root items
hLetter = m_treeFiles.InsertItem("Other");
int bMoreFiles = 1;
//Find the first file in the main directory
hFind = FindFirstFile(m_strMainDir + "\\*.*", &dataFind);
//countinue to loop until all files have been found
while((hFind != INVALID_HANDLE_VALUE) && (bMoreFiles == 1 ))
//Check a file has been found and not a directory
if (dataFind.dwFileAttributes == FILE_ATTRIBUTE_ARCHIVE)
//Get the first letter of the file name
int nChar = dataFind.cFileName;
//convert lower case letters to uppercase letters
//if the file name start with a letter then subtract 'A' to find the index in
//to the hLetter array, for others use index 26
else nChar =26;
//insert the file name in to the trees
//find the next file in the main directory
bMoreFiles = FindNextFile(hFind, &dataFind);
//close the file handle
I know I have said a great deal, but I was trying to explain what I desired.
Just so you know I am using a VC++ 5.0 compilier, and I have only been working with VC++ for a little over a week.
Thank you very much for your help.
September 15th, 2003, 05:08 PM
If you can, why not just display a CFileDialog class object, instead of your own dialog box. See http://msdn.microsoft.com/library/de...FileDialog.asp for documentation and http://msdn.microsoft.com/library/de...3a.domodal.asp for a code sample
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
September 16th, 2003, 03:12 PM
Thanks for the response. Okay, I would like to state right of the bat that I am a beginner when it comes to VC++. I have only dealt with it for about a week. Now having that off my shoulders.
I have never dealt with, DoModal.
Okay, for starters I am a little confused. As far as the non coding part, I need to use a list to do your suggestion. Right?
Okay, in the coding section. First where is that m_ofn structure thing that they were talking about? Those links are very nice but are very confusing to me. It definitely assumes you know a lot.
Sorry to be a bother.
Thanks for the help