Does windows XP use COM to determine file associations?
-
I've got an app that uses a ShellExecute to launch the default web browser via ShellExecute(NULL, "open", "http://somewebsite.com", NULL, NULL, SW_SHOWNORMAL); On XP, sometimes it works and other times it doesn't resulting in an Error code 5 being returned from the ShellExecute (error code 5 = SE_ACCESS_DENIED) indicating that the OS refused to launch the default web browser. From the MSDN documentation for ShellExecute, I noticed the bit about if what you are launching uses COM, you will need to initialize COM in your app before calling ShellExecute. When I add the CoInitialize(NULL) at app startup (and the CoUninitialize at the close), it fixes the problem and the page launches every time. This is all great...but why does it work? the only thing I can come up with is that Windows uses COM to determine what app should open html files. Except that doesn't make sense as to why it sometimes works... What am I missing? Oh, and Vista/win7 works. This behavior is only seen on XP
-
I've got an app that uses a ShellExecute to launch the default web browser via ShellExecute(NULL, "open", "http://somewebsite.com", NULL, NULL, SW_SHOWNORMAL); On XP, sometimes it works and other times it doesn't resulting in an Error code 5 being returned from the ShellExecute (error code 5 = SE_ACCESS_DENIED) indicating that the OS refused to launch the default web browser. From the MSDN documentation for ShellExecute, I noticed the bit about if what you are launching uses COM, you will need to initialize COM in your app before calling ShellExecute. When I add the CoInitialize(NULL) at app startup (and the CoUninitialize at the close), it fixes the problem and the page launches every time. This is all great...but why does it work? the only thing I can come up with is that Windows uses COM to determine what app should open html files. Except that doesn't make sense as to why it sometimes works... What am I missing? Oh, and Vista/win7 works. This behavior is only seen on XP
kinar wrote:
the only thing I can come up with is that Windows uses COM to determine what app should open html files.
Last time I checked, it consulted the registry.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
kinar wrote:
the only thing I can come up with is that Windows uses COM to determine what app should open html files.
Last time I checked, it consulted the registry.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
DavidCrow wrote:
Last time I checked, it consulted the registry.
Did you consult the registry to come up with such conclusion? :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
DavidCrow wrote:
Last time I checked, it consulted the registry.
Did you consult the registry to come up with such conclusion? :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]No, I used an API.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons