Solved

add open file dialog to win32 app

Posted on 2002-07-14
3
426 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 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

626 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