Discussion:
How to open a windows folder ?
(too old to reply)
"Robert Puts" @gmx.org>
2005-05-27 14:11:02 UTC
Permalink
I need to open a windows folder (not the windows open dialog, but the actual
folder) from within delphi, something like

cFld:="C:\Windows\System32";
OpenFolder(cFld);

where do I find this ?
Thanks !
Maarten Wiltink
2005-05-27 14:27:51 UTC
Permalink
Post by "Robert Puts" @gmx.org>
I need to open a windows folder (not the windows open dialog, but
the actual folder) from within delphi, something like
cFld:="C:\Windows\System32";
OpenFolder(cFld);
Define "open".

Groetjes,
Maarten Wiltink
Tom de Neef
2005-05-27 22:18:19 UTC
Permalink
Post by "Robert Puts" @gmx.org>
I need to open a windows folder (not the windows open dialog, but the actual
folder) from within delphi, something like
cFld:="C:\Windows\System32";
OpenFolder(cFld);
where do I find this ?
Thanks !
I guess you want to open it in order to access files in it for display,
reading, deletion, etc. If you can inform us about the purpose of opening
the folder, we may be able to give you hints.
Tom
Nicholas Sherlock
2005-05-28 00:40:12 UTC
Permalink
Post by "Robert Puts" @gmx.org>
I need to open a windows folder (not the windows open dialog, but the actual
folder) from within delphi, something like
cFld:="C:\Windows\System32";
OpenFolder(cFld);
Easy, use shellexecute!


uses shellapi;
begin
shellexecute(handle,'open','C:\windows\system32',nil,nil,sw_shownormal);
end;

Cheers,
Nicholas Sherlock
Jens Björnhager
2005-05-28 11:05:45 UTC
Permalink
Post by Nicholas Sherlock
uses shellapi;
begin
shellexecute(handle,'open','C:\windows\system32',nil,nil,sw_shownormal);
end;
And you could extract the location of the windows folder from the
environment variable SystemRoot;

function GetEnvironmentString(s:string):string;
begin
SetLength(Result,8192);
SetLength(Result,Windows.GetEnvironmentVariable(PChar(s),PChar(Result),8192));
end;

sysroot:=GetEnvironmentString('systemroot');
shellexecute(handle,'open',sysroot,nil,nil,sw_shownormal);
g***@interdesigner.com
2005-05-28 11:37:30 UTC
Permalink
How can I open Windows Explorer, and automatically select a file? I see
several software in Delphi can do this, but couldn't found any
documentation about.

Example: I want to open in Windows Explorer the file c:\tmp\file.txt

The function to open the "c:\tmp" folder is posted here, but how can I
do the opened Windows Explorer to "point"/select the "file.txt" file?
Is there a code example?

Thanks in advance

Daniel
Post by Nicholas Sherlock
Post by "Robert Puts" @gmx.org>
I need to open a windows folder (not the windows open dialog, but the actual
folder) from within delphi, something like
cFld:="C:\Windows\System32";
OpenFolder(cFld);
Easy, use shellexecute!
uses shellapi;
begin
shellexecute(handle,'open','C:\windows\system32',nil,nil,sw_shownormal);
end;
Cheers,
Nicholas Sherlock
KLite
2005-05-28 11:47:40 UTC
Permalink
How can I open Windows Explorer, and automatically select a file? I see

several software in Delphi can do this, but couldn't found any
documentation about.


Example: I want to open in Windows Explorer the file c:\tmp\file.txt


The function to open the "c:\tmp" folder is posted here, but how can I
do the opened Windows Explorer to "point"/select the "file.txt" file?
Is there a code example?


Thanks in advance


Daniel

Loading...