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

File Open Dialog Box in ATL ActiveX Control

Posted on 2002-04-06
3
401 Views
Last Modified: 2010-08-05
Hi All...

I'm developing an ActiveX control in ATL. It has a property called "FileName". I would like to bring up the file open dialog box when the user clicks that "FileName" property in VB. I mean when the user clicks the "..." button.

Pls help me!!!


Rgds
Jagadeesh
0
Comment
Question by:coxswain
3 Comments
 
LVL 22

Accepted Solution

by:
ambience earned 300 total points
ID: 6941164
In your handler for "..." open the file dialog

TCHAR filename [ MAX_PATH ];
filename[0] = 0;

OPENFILENAME fn;
ZeroMemory(&fn, sizeof fn);
fn.lStructSize = sizeof(fn); // for Win 2000
fn.lStructSize = OPENFILENAME_SIZE_VERSION_400 ; // for Win 9x, NT
fn.lpstrFilter = _T("Text Files\0*.txt\0\0");
fn.lpstrFile = filename;
fn.Flags = OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;

if(GetOpenFileName(&fn))
{
   // filename  now has file selected by user.
}

hope this helps
0
 
LVL 11

Expert Comment

by:griessh
ID: 6957242
Dear coxswain

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "ambience"

comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points. The link to the Community Support area is: http://www.experts-exchange.com/commspt/

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 6979192
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

856 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