Answered by:
Porting custom COM to Metro

Question
-
I have an legacy custom COM DLL which i want to call from a new Metro app i am writing.
My COM DLL is written in native C++ using ATL. It calls lots of Win32 functions and does lots of registry reading/writing.
Can i simply register my COM object in the usual way using regsvr32 and call it directly from my Metro app ( using CoCreateInstanceFromApp ) ????
If not, what are my options ?
Many thanks for any help/pointers.
Adrian
Monday, February 6, 2012 12:17 PM
Answers
-
Hi Adrian,
Metro style apps do not have access to the registry and cannot do IPC with a desktop app to encourage it to do so.
Metro style apps shouldn't have any need for the registry. If your application's goal is to manipulate the registry it would probably be better off as a desktop app. If it is just using the registry for settings then it should use the app data store instead.
--Rob
- Marked as answer by DavidLambMicrosoft employee, Moderator Wednesday, February 8, 2012 11:12 PM
Wednesday, February 8, 2012 1:49 AMModerator
All replies
-
Hi Adrian,
Metro style apps do not have access to the registry and cannot load arbitrary COM objects.
You would need to rewrite your COM DLL to use only API available to Metro style apps. It could then be included without registration in your app package and loaded from there.
--Rob
Monday, February 6, 2012 5:53 PMModerator -
Rob,
many thanks for the reply. Looks like i'll soon be beginning the laborious process of of rewriting the COM DLL....
one last question, if i need my metro style app to read/write the registry how would i do it ??? I suppose i could have it write out a file that is then picked up by a desktop app which updates the registry accordingly -- sounds massively cludgy though ...
Adrian
Tuesday, February 7, 2012 2:20 PM -
Hi Adrian,
Metro style apps do not have access to the registry and cannot do IPC with a desktop app to encourage it to do so.
Metro style apps shouldn't have any need for the registry. If your application's goal is to manipulate the registry it would probably be better off as a desktop app. If it is just using the registry for settings then it should use the app data store instead.
--Rob
- Marked as answer by DavidLambMicrosoft employee, Moderator Wednesday, February 8, 2012 11:12 PM
Wednesday, February 8, 2012 1:49 AMModerator