Delphi: Show Path in Windows Explorer
Question by Guest | Last update on 2022-07-27 | Created on 2014-08-18
I have already read the question about how to open a specific directory, path or folder in the Windows Explorer using Lazarus. However, when using Delphi, there is no function called OpenDocument available that is used there.
Does someone have any solution that is also working in Delphi? I would like to use Lazarus for this purpose, but at our school, we are forced to implement it in Delphi.
Related Topics
Lazarus: Detect Operating System (Compiler Switch)
Tutorial | 0 Comments
HTML5 Canvas: Beginner Tutorial Chapter 3 - Rectangles and Circles
Tutorial | 0 Comments
Windows: Useful Keyboard Shortcuts
Info | 0 Comments
Delphi: System-Wide HotKey
Tutorial | 1 Comment
CSS Hacks for the Internet Explorer
Tip | 1 Comment
HTML5 Canvas: Beginner Tutorial Chapter 2 - Drawing Lines
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
In Delphi, you can use the function ShellExecute for this purpose. Although this function does not only have one parameter like OpenDocument, it also can open the Explorer:
Or:
In the first example, we set the second parameter to "nil" making Windows to select the default program for file paths. In the second case, we are passing "explore" making Windows to use the Windows Explorer in each case to open the directory (a user may also have set another default application for directories on his system).
And here is another example using a variable:
Important: The unit ShellApi has to be included.
Last update on 2022-07-27 | Created on 2014-08-18