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
Solved

add open file dialog to win32 app

Posted on 2002-07-14
3
416 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
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 100 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

840 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