It says "identifier CoCreateInstanceAsAdmin is undefined.
I have read that article on The COM Elevation Moniker several times now but I fail to understand what to do.
It says on the example "It assumes that you have already initialized COM on the current thread."
I guess I have not done this. How do I do it? I use visual studio if that matters.
Hello
Yes maybe you are right.
Do you know how to do this? I searched for it and found it in C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64 but not sure if this is the right lib or if it is a c# lib or something...
I did not manage to use it add it to references either.
I tried by setting project property common language runtime support clr and then browse for the lib under references -COM. But it says it is of type version the project cant use.
Not sure if it is because it is the wrong file, or if I try to add it in the wrong way.
Do you know this?
Well that is the same link as in my post. But I do not really understand it I think. Does this mean I cant use it? Do you think it is possible to create a smart card with the class somehow?
Are you calling CoInitializeEx()? That is how you load the COM Library. If either CoInitialize() or CoInitializeEx() isn't called, every COM related call will fail. Those calls - as all COM calls, return an HRESULT, which can be checked for success / failure.
On the current MSDN link they talk about Windows::Foundation or something to that effect. Don't know anything about it. That's above my pay grade too. Just CoInitializeEx() ought to work. Note there is a CoUninitialize() too that should be called at clean up.