I have an LPTSTR
for a file path, i.e. C:\Program Files\Ahoy
. I would like to convert it to a file://
URL that I can pass to ShellExecute in order to start the system's default browser pointing at the file. I don't want to give the path to ShellExecute directly since file associations may result in it being opened by something other than a web browser. The path is arbitrary, and may contain characters that need to be escaped.
Is there an existing library function, along the lines of Python's urllib.pathname2url, that does this translation? This can be done via the Uri class in .NET, but I haven't found anything for plain win32.
There's the UrlCreateFromPath
API:
http://msdn.microsoft.com/en-us/library/bb773773%28VS.85%29.aspx
There's an entire path handling library within Win32. It's called Shell Path Handling Functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With