Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

add open file dialog to win32 app

Posted on 2002-07-14
3
Medium Priority
?
431 Views
Last Modified: 2008-03-06
I have a simple win32 application that i wrote that loads a .bmp(hard coded filename) and displays it. Right now it has a menu at the top that only has File -> Exit command.

I would like to add a menu item that opens a dialog to browse and open any .bmp that i want.

thanks
0
Comment
Question by:pesst
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Expert Comment

by:TheFriend
ID: 7152275
See MSDN.
0
 
LVL 2

Author Comment

by:pesst
ID: 7152664
See the question and come up with an answer before you propose one.
0
 
LVL 8

Accepted Solution

by:
fl0yd earned 400 total points
ID: 7152791
You will have to use the win-api-function GetOpenFileName and pass it an OPENFILENAME-structure. You can find further information on all those parameters and combinations possible here:
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/userinput/commondialogboxlibrary/commondialogboxreference/commondialogboxfunctions/getopenfilename.asp
and here:
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/userinput/commondialogboxlibrary/commondialogboxreference/commondialogboxstructures/openfilename.asp

For the menu question: Add an 'Open'-option to your File-menu and give a unique ID, let's call it ID_FILE_OPEN. Add a WM_COMMAND-message handler and check whether LOWORD( wParam ) == ID_FILE_OPEN.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question