Combobox with file browser

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2008
Posts: 42
Reputation: Adrian99420 is an unknown quantity at this point 
Solved Threads: 0
Adrian99420 Adrian99420 is offline Offline
Light Poster

Combobox with file browser

 
0
  #1
Apr 4th, 2008
Hi,

I am using visual C++ 2005 express edition. I created a window form application with several combobox. The combobox contain few default items (pictures for example). Now I wish to create a file browser which allow user to choose picture from others directory and added it into the combobox. How can I do this?

I look through the combobox properties for long but still unable to find such function. Besides, I also seached through many forums for file browser function but still not getting any respond.

Can any pro fren provide me some guide?? I need this urgently, Thanks in advance.

Regards,

Adrian
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 147
Reputation: Laiq Ahmed will become famous soon enough Laiq Ahmed will become famous soon enough 
Solved Threads: 20
Laiq Ahmed Laiq Ahmed is offline Offline
Junior Poster

Re: Combobox with file browser

 
0
  #2
Apr 4th, 2008
Are you using Win32 API, MFC, WTL or Managed C++.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,378
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1466
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Combobox with file browser

 
0
  #3
Apr 4th, 2008
I know that compiler does not support MFC but you might browse www.codeproject.com because they probably have an mfc combo box class that does something like that and will give you ideas how to do it with win32 api functions.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 42
Reputation: Adrian99420 is an unknown quantity at this point 
Solved Threads: 0
Adrian99420 Adrian99420 is offline Offline
Light Poster

Re: Combobox with file browser

 
0
  #4
Apr 7th, 2008
Originally Posted by Laiq Ahmed View Post
Are you using Win32 API, MFC, WTL or Managed C++.
Hi,

I am using Win32 API, I created a few combobox using the toolbox and now I wish to add in a file browser function. It is something like the "attach file function" in this forum, we can browse the file in our PC and added it to the combobox.

How am I able to do this? Here I attached my code in the link (http://developer.sonyericsson.com/thread/44297) if my explanation is not clear.

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 147
Reputation: Laiq Ahmed will become famous soon enough Laiq Ahmed will become famous soon enough 
Solved Threads: 20
Laiq Ahmed Laiq Ahmed is offline Offline
Junior Poster

Re: Combobox with file browser

 
0
  #5
Apr 7th, 2008
Hmmm, Lets do it .
Your Combo must be Owner Drawn.

1. Handle the DrawItem Event of the ComboBox.
2. HICON hIcon = LoadImage (...); // this API will Load the icon(s).
3. Keep the icons in any collection. to fill the ComboBox.
4.In the DrawItem Event
DrawIconEx(...); use this API function... to draw the icon on ith item.

Follow the above steps. I prefer using ATL/WTL classes for the above TASK . well you can do the same using WIN32 API.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 42
Reputation: Adrian99420 is an unknown quantity at this point 
Solved Threads: 0
Adrian99420 Adrian99420 is offline Offline
Light Poster

Re: Combobox with file browser

 
0
  #6
Apr 7th, 2008
Hi,

Thanks for your reply. In fact my combo is created from the toolbox. I am using VS C++ 2005 express edition, the window application provides GUI function, so I juz select the combobox and drag it out.

Besides, my combobox items are juz simple strings. This GUI that I am creating is juz a simple interface, I linked it up with other program.

So, I juz wan to make a simple file browser function to add the "name(string)" of file selected into the combobox.

Any help? For clearer explanation will be on the attached link. Thanks
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 978
Reputation: mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice 
Solved Threads: 208
mitrmkar mitrmkar is offline Offline
Posting Shark

Re: Combobox with file browser

 
0
  #7
Apr 7th, 2008
Originally Posted by Adrian99420 View Post
So, I juz wan to make a simple file browser function to add the "name(string)" of file selected into the combobox.
Then you can probably use the GetOpenFileName function, see
http://msdn2.microsoft.com/en-us/lib...27(VS.85).aspx
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 42
Reputation: Adrian99420 is an unknown quantity at this point 
Solved Threads: 0
Adrian99420 Adrian99420 is offline Offline
Light Poster

Re: Combobox with file browser

 
0
  #8
Apr 8th, 2008
Hi,

Thanks for your reply, I read through the function, i think visual C++2005 express edition provide a similar tool called FolderBrowserDialog.

I am quite new in C++ programming. I created a button beside my combobox and I link it to a new window form (or dialog) juz with the folderbrowserdialog. After that , I have no idea how to make the folderbrowserdialog works and how to link the string(name of file) it get back to the combobox.

Can you show me a simple example on that?

Million thanks in advance.

Regards,

Adrian
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 978
Reputation: mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice 
Solved Threads: 208
mitrmkar mitrmkar is offline Offline
Posting Shark

Re: Combobox with file browser

 
0
  #9
Apr 8th, 2008
It is simple to use ...
  1. // Invoke the dialog box...
  2. folderBrowserDialog1->ShowDialog();
  3. // User just closed the dialog ... display whatever was selected ...
  4. System::Windows::Forms::MessageBox::Show(folderBrowserDialog1->SelectedPath);

However, note that it browses for folders (not files)
Last edited by mitrmkar; Apr 8th, 2008 at 7:14 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC