0

I'm looking for function that Open window explorer in C language. I have found this [answer](How can I open Windows Explorer to a certain directory from within a WPF app?), but this is C# language. C can't have these features? I use VS 2010.

I'm a beginner of C. So my question may seem ridiculously easy. But if you give me the answer I really appreciate it. Thanks :)

Community
  • 1
  • 1
Soyeon Kim
  • 608
  • 7
  • 34
  • 1
    unicode: `ShellExecute(NULL, L"open", L"c:\\", 0, 0, SW_SHOWNORMAL);` or `ShellExecute(NULL, "open", "c:\\", 0, 0, SW_SHOWNORMAL);` – Barmak Shemirani Mar 24 '15 at 06:26
  • 1
    [Link to the above](https://msdn.microsoft.com/en-ca/library/windows/desktop/bb762153(v=vs.85).aspx). – WhozCraig Mar 24 '15 at 06:28

3 Answers3

2

Try using SHOpenFolderAndSelectItems() function, which can open files in windows explorer.

https://msdn.microsoft.com/en-us/library/windows/desktop/bb762232(v=vs.85).aspx

Karthikeyan
  • 381
  • 8
  • 19
2

The simplest way to open a certain directory in an explorer (here c:\program files) may be:

system("start \"\" \"c:\\program files\"");
Joël Hecht
  • 1,766
  • 1
  • 17
  • 18
1

Given the stslib.h library contains the system() function that let's you run shell commands, you should be able to run the command to open a new windows explorer window using the same command you would use in the terminal window.

A guideline: http://www.programmingsimplified.com/c-program-shutdown-computer