Solved

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

Posted on 2006-10-21
3
552 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

813 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

16 Experts available now in Live!

Get 1:1 Help Now