Solved

File Open Dialog Box in ATL ActiveX Control

Posted on 2002-04-06
3
369 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now