Closed Akarinnnnn closed 4 years ago
Did you in fact call CoInitializeEx
in your main entry-point? As noted in the doc page you reference, I'm assuming your app has already initialized COM. This is not done by the internal library code since there are some parameters involved, and depends on the exact platform you are targeting.
In other words, your application is supposed to initialize COM before you call LoadWICFromFile
.
Did you in fact call
CoInitializeEx
in your main entry-point? As noted in the doc page you reference, I'm assuming your app has already initialized COM. This is not done by the internal library code since there are some parameters involved, and depends on the exact platform you are targeting.In other words, your application is supposed to initialize COM before you call
LoadWICFromFile
.
Not at all. In my case I reference _DirectXTex_Desktop_2019Win10.vcxproj, which means Classic Win32 Application. preprocessor ignored CoInitializeEx
because _WIN32_WINNT >= 0x0A00
.
Then you called RoInitialize
which does init COM.
Are you trying to use WIC loader from a different thread?
Then you called
RoInitialize
which does init COM.Are you trying to use WIC loader from a different thread?
RoInitialize
in my case does not initalize s COM.That's what RoInitialize
does... The Windows Runtime includes starting up COM.
That said, you don't need the Windows Runtime for DirectXTex. Have you tried just using:
HRESULT hr = CoInitializeEx(nullptr, COINITBASE_MULTITHREADED);
if (FAILED(hr))
// error
And making sure that the HRESULT is a success?
That's what
RoInitialize
does... The Windows Runtime includes starting up COM.That said, you don't need the Windows Runtime for DirectXTex. Have you tried just using:
HRESULT hr = CoInitializeEx(nullptr, COINITBASE_MULTITHREADED); if (FAILED(hr)) // error
And making sure that the HRESULT is a success?
Yes.That's what I use, hr is also success.
again, RoInitalize
DID NOT INITIALIZE COM
I'm sorry, but I'm at a loss as to the cause of your problem. The Microsoft Docs covers this in detail, so hopefully something there makes sense to you.
In desktop win10, when I try to use
DirectX::LoadFromWICFile()
function, it returns E_NOINTERFACE, I think it's imopssiable. As I use debugger to find out why it returns this, I foundget into
GetWICFactory(iswic2)
into
InitializeWICFactory()
here,
hr
isE_NOTINITIALIZED
,means COM are not initialized.So, maybe we need to change this initializiation code?