Solved

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

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

707 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