Solved

add open file dialog to win32 app

Posted on 2002-07-14
3
419 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Title # Comments Views Activity
C++ Class Serialization, Encapsulation and Formatted Output 8 90
sorting efficency of sorting algorithm 30 130
Dialogbox API leak? 18 109
White board coding practice 3 93
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

756 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