🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
9 messages
9 total messages Started by Jos� Sat, 22 Apr 2006 20:13
Memory in TOpenDialog
#3859
Author: Jos�
Date: Sat, 22 Apr 2006 20:13
8 lines
1097 bytes
My program stores no data, but when I do OpenDialog1->Execute() it
displays the directory I used in the previous execution of this
program.

1. Where is this data stored?
2. How can I obtain this data without doing OpenDialog1->Execute() ?
-- 
Jos�
Re: Memory in TOpenDialog
#3860
Author: Michel Leunen
Date: Sat, 22 Apr 2006 20:25
22 lines
1866 bytes
Jos� wrote:
> My program stores no data, but when I do OpenDialog1->Execute() it
> displays the directory I used in the previous execution of this
> program.

Look at TOpenDialog::InitialDir.
According to the help file:
"If no value is assigned to InitialDir, or if the specified directory 
does not exist, the initial directory is controlled by the global 
ForceCurrentDirectory variable. If ForceCurrentDirectory is true, the 
dialog opens with the current working directory displayed. Otherwise, 
the dialog opens with either the current working directory or the My 
Documents directory, depending on the version of Windows."

Michel
-- 
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
----------------------------------------
Re: Memory in TOpenDialog
#3861
Author: Jos�
Date: Sat, 22 Apr 2006 21:14
30 lines
2063 bytes
On Sat, 22 Apr 2006 22:25:52 +0200, Michel Leunen
<nospam@noreply.please> wrote in borland.public.cppbuilder.nativeapi:

>Look at TOpenDialog::InitialDir.

It's empty.

>According to the help file:
>"If no value is assigned to InitialDir, or if the specified directory 
>does not exist, the initial directory is controlled by the global 
>ForceCurrentDirectory variable. If ForceCurrentDirectory is true, the 
>dialog opens with the current working directory displayed. Otherwise, 
>the dialog opens with either the current working directory or the My 
>Documents directory, depending on the version of Windows."

My help file says: If no value is assigned to InitialDir, or if the
specified directory does not exist, the dialog opens with the current
working directory displayed.

But what is the Current Working Directory? Where is this info stored
(each program stores it separately and it survives a reboot) and how
to retrieve it without calling OpenDialog->Execute() ?

getdcwd and getcurdir won't do, since these require a drive letter.
Besides, these functions probably produce info which is system wide,
and which does not resist a reboot. So this is not the info I want.


-- 
Jos�
Re: Memory in TOpenDialog
#3862
Author: Bob Gonder
Date: Sat, 22 Apr 2006 22:02
5 lines
1151 bytes
Jos� wrote:

>But what is the Current Working Directory?

See  GetCurrentDirectory()
Re: Memory in TOpenDialog
#3864
Author: Jos�
Date: Sun, 23 Apr 2006 10:15
11 lines
1223 bytes
On Sat, 22 Apr 2006 15:02:41 -0700, Bob Gonder
<notbg@notmindspring.invalid> wrote in
borland.public.cppbuilder.nativeapi:

>>But what is the Current Working Directory?
>
>See  GetCurrentDirectory()

Nope, this produces the folder where my EXE is located.
-- 
Jos�
Re: Memory in TOpenDialog
#3865
Author: Jos�
Date: Sun, 23 Apr 2006 10:22
26 lines
1760 bytes
On Sat, 22 Apr 2006 22:13:13 +0200, Jos� <jose@127.0.0.1> wrote in
borland.public.cppbuilder.nativeapi:

>My program stores no data, but when I do OpenDialog1->Execute() it
>displays the directory I used in the previous execution of this
>program.
>
>1. Where is this data stored?
>2. How can I obtain this data without doing OpenDialog1->Execute() ?

Currently I know only one way to do it, but it requires user
intervention, and there must be at least one file in the folder.

call OpenDialog1->Execute()
instruct user to do the following:
  do not change to another folder
  select any file
  Click Open
Read OpenDialog1->FileName and remove all text after the last
backslash.

Unfortunately there is nothing in OpenDialog1->FileName before the
method is called. And I have no idea where OpenDialog obtains the
folder name.
-- 
Jos�
Re: Memory in TOpenDialog
#3870
Author: Bob Gonder
Date: Sun, 23 Apr 2006 16:39
28 lines
2170 bytes
Jos� wrote:
>On Sat, 22 Apr 2006 15:02:41 -0700, Bob Gonder wrote
>
>>>But what is the Current Working Directory?
>>
>>See  GetCurrentDirectory()
>
>Nope, this produces the folder where my EXE is located.

Not always.
A)You can specify a different working directory when you create a
shortcut. 
B)From a command prompt, you can execute a program by supplying the
full path to the executable, or if it can be found in your PATH
environment... The current directory will remain the directory of the
command prompt (unless the app changes it).

See the Help on "Object Working Directory"
And the links within that topic.

Those are the only "Current" and/or "Working" directories mentioned.


Or are you talking about point #3 under
	lpstrInitialDir
		Windows 2000/XP:
at (long URL might wrap)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/commondialogboxlibrary/commondialogboxreference/commondialogboxstructures/openfilename.asp
Re: Memory in TOpenDialog
#3875
Author: Jos�
Date: Mon, 24 Apr 2006 08:29
19 lines
1629 bytes
On Sun, 23 Apr 2006 09:39:54 -0700, Bob Gonder
<notbg@notmindspring.invalid> wrote in
borland.public.cppbuilder.nativeapi:

>>>See  GetCurrentDirectory()
>>
>>Nope, this produces the folder where my EXE is located.
>
>Not always.
>A)You can specify a different working directory when you create a
>shortcut. 
>B)From a command prompt, you can execute a program by supplying the
>full path to the executable, or if it can be found in your PATH
>environment... 

But, as you can see in my original post, this is not what I want.

-- 
Jos�
Re: Memory in TOpenDialog
#3787
Author: Bob Gonder
Date: Mon, 24 Apr 2006 17:57
10 lines
1661 bytes
Jos� wrote:

Did you check out the URL I posted? You didn't comment on that.

>But, as you can see in my original post, this is not what I want.

Then maybe you should ask in vcl.components.using, because if none of
these answers are what you are asking for, then I have no clue what
your original post was asking. (The URL had what I consider the
closest answer to your original post.)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads