Solved

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

Posted on 2006-10-21
3
562 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month7 days, 5 hours left to enroll

623 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