| | |
Combobox with file browser
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2008
Posts: 42
Reputation:
Solved Threads: 0
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
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
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.
•
•
Join Date: Jan 2008
Posts: 42
Reputation:
Solved Threads: 0
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.
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.
•
•
Join Date: Jun 2006
Posts: 147
Reputation:
Solved Threads: 20
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.
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. •
•
Join Date: Jan 2008
Posts: 42
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Nov 2007
Posts: 978
Reputation:
Solved Threads: 208
•
•
•
•
So, I juz wan to make a simple file browser function to add the "name(string)" of file selected into the combobox.
http://msdn2.microsoft.com/en-us/lib...27(VS.85).aspx
•
•
Join Date: Jan 2008
Posts: 42
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Nov 2007
Posts: 978
Reputation:
Solved Threads: 208
It is simple to use ...
However, note that it browses for folders (not files)
C++ Syntax (Toggle Plain Text)
// Invoke the dialog box... folderBrowserDialog1->ShowDialog(); // User just closed the dialog ... display whatever was selected ... 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.
![]() |
Similar Threads
- Cannot find server or DNS Error - please help! (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: SetViewPortPixel function - Drawing from Bitmap
- Next Thread: GMarkupParser
| Thread Tools | Search this Thread |
api array based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






