How to locate a file in windows explorer - winapi

I have a application to list all music files in user machine, a "Explorer" button is using to quickly open Windows Explorer and highlight the file in Windows Explorer. I tried ShellExecute, but it doesn't work, the API will launch associate application. Any Windows API can do that? Thanks in advance.

You can simply start explorer.exe with the /select argument, as detailed in this Knowledge Base article:
Explorer /select,C:\TestDir\TestApp.exe

You can create an IE instance and navigate to your folder, then query the IShellBrowser service from the top level browser service and get the active view's IShellView interface. Use IShellView::SelectItem to select items.
Remember to call IWebBrowser::Quit when you don't need the explorer window.
This method can not get around Windows Vista's User Interface Privilege Isolation. If the folder is opened in a process with a different integrity level, a broker IE extension is needed to continue the automation.

Related

How to make my browser (such as Firefox) open a custom File Manager?

My system is Windows 11 build 22621. Now I use Tablacus Explorer to manage my files instead of Explorer.exe, however, many apps (such as Firefox or Control Panel) will still use Explorer.exe when I try to open directory or other something in those apps,even though I used some Tablacus's plugins such as Shell Execute Hook.
Are there better methods to let other apps to auto open Tablacus as more as possible?
Add "Open Instead" and "System Tray" plugin to solve the problem.

Make an Internet Shortcut file open Internet Explorer

I currently have an Internet Shortcut file "My Link.url":
[InternetShortcut]
URL=https://somewebsite.com
I believe Internet Shortcut files are always opened in the default browser.
Does anyone know how to force opening in Internet Explorer?
I have come across .website files but Windows Security Shield (is that the right name?) blocks it opening.
Use case: *nix server creating a file that will be downloaded to the users desktop.
You should be able to use a normal .lnk shortcut point it to iexplore.exe and supply your url as the first parameter

Why access using IE browser and access using Windows explorer of INetCache folder shows different folder structure on WIN8.1-IE11?

When I access C:\Users\shan\AppData\Local\Microsoft\Windows\INetCache using Windows explorer, it shows following folder structure:
But when I access the same using IE11 browser, Tools->Internet Options->General->Browsing history-> Settings(click)->View files(click), I get different folder structure as follows:
Why folder structure differing in above 2 cases, even though both are referring to the same physical location on Windows 8.1, IE11 Browser ?
I need to write a script which clears this INetCache folder contents(Cache). But not able to get the exact content of this folder. Because it always refers to Folder which contains Low(folder), Virtualized(folder) and counters.dat(file). In my script I want to refer the folder which contains favicon.ico files.
The same behavior is observed on IE10-win7 and IE11-win7 as well, while referencing Temporary Internet Files.
There is an internal api in the IE libraries that controls clearing of the 'Internet Cache'....
there are two... one for 'normal' integrity processes (64 bit tab processes and ActiveX (flash)), another for low integrity processes (32 bit tab processes and ActiveX (flash))
Use GPO (Start>Run>gpedit.msc) to configure user profiles on a domain network to empty the TIF(s) on exit from the browser.
For computers on a public access network (library workstations), you can default to inPrivate Mode from a desktop or Taskbar link
iexplore.exe -private
which does not retain any personally identifiable data of the user in history, or cookies or flash cookies.....
questions about GPO management of IE should be posted to the TechNet support forum for IE.
https://social.technet.microsoft.com/Forums/ie/en-US/home?forum=ieitprocurrentver

How to get items to be displayed in left navigation pane of windows explorer

I need to get all the items in the left navigation pane of windows explorer.Same as a new explorer window would display i.e. taking into account the user settings.
i am not getting any API or registry where i can get these settings.
I can get the details of these folder (Favorites, Libraries, Network etc. ) in general using IKnownFolderManager and IKnownFolder COM interfaces.
But my problem is i only want to get the items which user has enabled/customized to display in explorer. where these explorer settings are saved ?
please suggest any Win32/COM API or any other programmable way to get this done.
thanks in advance.
Take a look at windows libraries api.

How to launch an application from a browser?

Is it possible to launch an application from a browser? I am not talking about opening a file from a browser (like open a PDF with Adobe Reader), but rather opening a new (blank) instance of an application that is installed on the user's machine.
Hypothetical situation: User browses a website that lists computers that can be managed via RDP. He clicks on a link to 192.168.1.10, that link opens Microsoft RDP client (mstsc.exe) with that ip address already filled out.
I am talking strictly about Windows universe.
Is that thing even doable outside of ActiveX and IE?
Is it wise to attempt this in IE with ActiveX?
The correct method is to register your custom URL Protocol in windows registry as follows:
[HKEY_CLASSES_ROOT\customurl]
#="Description here"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\customurl\shell]
[HKEY_CLASSES_ROOT\customurl\shell\open]
[HKEY_CLASSES_ROOT\customurl\shell\open\command]
#="\"C:\\Path To Your EXE\\ExeName.exe\" \"%1\""
Once the above keys and values are added, from the web page, just call "customurl:\\parameter1=xxx&parameter2=xxx" . You will receive the entire url as the argument in exe, which you need to process inside your exe. Change 'customurl' with the text of your choice.
You can't really "launch an application" in the true sense. You can as you indicated ask the user to open a document (ie a PDF) and windows will attempt to use the default app for that file type. Many applications have a way to do this.
For example you can save RDP connections as a .rdp file. Putting a link on your site to something like this should allow the user to launch right into an RDP session:
Server 1
#AbhijithCR 's reply works well. To register the protocol via a .bat file, do something like this
set key=customurl
reg add HKCR\%key% /ve /d "URL:Description"
reg add HKCR\%key% /v "URL Protocol" /d ""
reg add HKCR\%key%\shell
reg add HKCR\%key%\shell\open
reg add HKCR\%key%\shell\open\command /ve /d ""c:\path to\your.exe" ""%%1"""
For me getting all the quotes and the double percent signs right was the tricky part.
Some applications launches themselves by protocols. like itunes with "itms://" links. I don't know however how you can register that with windows.
We use a sonicwall vpn. It launches a java applet that launches mstc with all the credentials setup. You really can't do this without a java applet or activex plugin.
Microsoft uses this technique itself on their small business server for getting inside the network. I wouldn't say it is a terrible idea, as long as platform independence isn't important.
You can use SilverLight to launch an application from the browser (this will work only on IE and Firefox, newer versions of chrome don't support this)
Example code here
I achieved the same thing using a local web server and PHP. I used a script containing shell_exec to launch an application locally.
Alternatively, you could do something like this:
Notepad

Resources