Solved

Explore with ShellExecute and giving "focus" to a specific file in the "files" pane

Posted on 2006-10-21
3
557 Views
Last Modified: 2010-04-05
hi
I can open a folder in Explorer with ShellExecute like so

ShellExecute(Application.Mainform.Handle,
                    pchar('explore'),
                    pchar('C:\Documents and Settings\Fred\My Documents')
but what I would really like to do is give "focus" to a specific FILE in the right hand files listing eg

ShellExecute(Application.Mainform.Handle,
                    pchar('explore'),
                    pchar('C:\Documents and Settings\Fred\My Documents\SomeBitmap.bmp')
which of course ShellExecute won't do. I looked at ShellExecuteEx and I can get to the properties page for a  noinated file, but that is not what I want.

Any idea how I can do this?

thanks

0
Comment
Question by:Mutley2003
  • 2
3 Comments
 
LVL 28

Expert Comment

by:TName
ID: 17779551
Have you tried
WinExec(pchar('explorer /e, /select, C:\Documents and Settings\Fred\My Documents\SomeBitmap.bmp '), SW_SHOW);
0
 
LVL 28

Accepted Solution

by:
TName earned 500 total points
ID: 17779637
or

ShellExecute(Handle,PChar('open'), PChar('explorer.exe'), PChar('/e, /select, C:\Documents and Settings\Fred\My Documents\SomeBitmap.bmp'), nil, SW_SHOW);
0
 

Author Comment

by:Mutley2003
ID: 17782558
thanks, works fine.. I did not think of the command line switches on Explorer (see here http://support.microsoft.com/kb/130510) .

Initially I had a lot of trouble with the debugger window popping up (D5) .. eventually I tracked it down to the option "debug spawned processes" under "debugger options" which I had checked.

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

821 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