Здравствуйте! Никак не могу инициализировать DirectX ни в VC++.NET ни в WinApi.
В NET выбрасывает ошибку:
'C:\WINDOWS1\assembly\GAC\Microsoft.DirectX.Direct3D\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.Direct3D.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.
public:
Device^ device;
void InitializeGrafics()
{
PresentParameters^ presentParams=gcnew PresentParameters();
presentParams->Windowed=true;
presentParams->SwapEffect=SwapEffect::Discard;
Device^ device=gcnew Device(0,DeviceType::Reference,this,
CreateFlags::SoftwareVertexProcessing,presentParams);
}
А в WinApi код такой:
LPDIRECT3DDEVICE9 pDevice = NULL;
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_COPY;
if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp, &d3dDevice ) ) )
return E_FAIL;