From: Sanjay Kulkarni on
I am not sure if this is the correct forum for this problem. But I
will go ahead and post it.

VB, like all other softwares that we use, has a FileOpen dialog that
is invoked by the File > Open menu.

I believe that there is an 'original' version of this dialog which
every software customizes according to its need (its my guess. I have
not verified it).

If this is true, where is the 'original' Microsoft dialog box? What
are its 'original' or 'basic' properties and methods? Is it in the
form of a Windows API call? Where can I know more about it.

I did a search on Microsoft but there were so many results I could not
locate the required info.

Thanks in advance for any help.
From: Wolfgang Enzinger on
Am Sun, 13 Jun 2010 02:33:18 -0700 (PDT) schrieb Sanjay Kulkarni:

> I believe that there is an 'original' version of this dialog which
> every software customizes according to its need (its my guess. I have
> not verified it).
>
> If this is true, where is the 'original' Microsoft dialog box? What
> are its 'original' or 'basic' properties and methods? Is it in the
> form of a Windows API call? Where can I know more about it.
>
> I did a search on Microsoft but there were so many results I could not
> locate the required info.

I guess what you're basically looking for is the GetOpenFileName() API
function.

VB declaration:
Public Declare Function GetOpenFileName Lib "comdlg32.dll" _
Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long

By adding the Microsoft Common Dialag Control Component to your project you
habe a comfortable encapsulation of this function, but it is a bit limited.
From: Mayayana on
There's an example of the GetOpenFileName
function that Wolfgang mentioned -- and links
to other related code -- here:

http://vbnet.mvps.org/code/comdlg/fileopendlg.htm


From: Sanjay Kulkarni on
Thanks for the responses.

What I am looking for is to understand that in any software when we
click File > Open in any software are we using essentially the
GetFileName function? For example, in one of the softwares that I use,
the File > Open dialog remembers the previous folder and provides it
as a default path for next open operation.

Is this the default behavior of the GetOpenFileName or the software
has added this functionality?

From: Thorsten Albers on
Sanjay Kulkarni <sanganaksakha(a)gmail.com> schrieb im Beitrag
<e7ae0c6f-063b-4122-a82e-8332e27a3718(a)s1g2000prf.googlegroups.com>...
> What I am looking for is to understand that in any software when we
> click File > Open in any software are we using essentially the
> GetFileName function? For example, in one of the softwares that I use,
> the File > Open dialog remembers the previous folder and provides it
> as a default path for next open operation.
>
> Is this the default behavior of the GetOpenFileName or the software
> has added this functionality?

The functionality of the dialog may be changed in two different ways:

a) By flags which have to be set (OPENFILENAME.Flags) before
GetOpenFileName() is called
(in addition some other members of the OPENFILENAME structure may change
the behaviour of the dialog too).

b) By a hook function (cmp. OPENFILENAME.lpfnHook) which allows to
customize the dialog after it has been created.

Although in most cases it is this common dialog which is used by
applications, due to these flags and the hook customization it is possible
that the dialog behaves very different in different applications.

--
Thorsten Albers

albers (a) uni-freiburg.de