Re: CoCreateInstance() returns E_OUTOFMEMORY




"Bala L" <balasubramanian.l@xxxxxxxxx> wrote in message news:876b2d02-75f1-436f-8457-862411eb5877@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am trying to use a program developed by someone else to interface
with a camera using the SDK. This program runs fine on a particular
laptop, but not on any other machines.

The code tries to initialize the camera object through a function
exposed through a .dll file.
m_pVidControl = new CCameraCtl();
m_pVidControl->Initialize(640,480); // Unhandled exception causes
crash
The program crashes on the second line, and by stepping in to the code
in the .dll, I found the error in the CoCreateInstance() function
call.
int CCameraCtl::Initialize(int width, int height)
{

//init camera capture com
HRESULT hresult;
hresult = CoCreateInstance(CLSID_CDirectShowGrabber, NULL,
CLSCTX_INPROC_SERVER, IID_IFilter, (void **)&(m_pGrabber)); //
Returns out of memory error

// Rest of function
}

The m_pGrabber has a valid address when it enters the Initialize()
function, but is again being reset to NULL after this line.

It doesn't matter what the value is that m_pGrabber holds. CoCreateInstance() is supposed to overwrite that value anyway with a valid interface pointer if CoCreateInstance() succeeeds.

Did you remember to call CoInitialize()?

Brian


.



Relevant Pages

  • pMedialControl->Stop() hangs indefinitely (sometimes)
    ... Each time a new camera is chosen, ... StartVideois called in a separate thread. ... HRESULT StopVideo(void) ... pMediaControl = NULL; ...
    (microsoft.public.win32.programmer.directx.video)
  • CoCreateInstance() returns E_OUTOFMEMORY
    ... The code tries to initialize the camera object through a function ... int CCameraCtl::Initialize ... HRESULT hresult; ... CoCreateInstance() is returning E_OUTOFMEMORY in hresult, ...
    (microsoft.public.vc.mfc)
  • Re: CoCreateInstance() returns E_OUTOFMEMORY
    ... > with a camera using the SDK. ... I found the error in the CoCreateInstance() function ... > HRESULT hresult; ... valid interface pointer if CoCreateInstancesucceeeds. ...
    (microsoft.public.vc.mfc)
  • Re: [opensuse] Laptop embedded Webcam
    ... Failed to initialize the device. ... There's the root of the problem, the camera is not initialising, so no app ... http://linux-uvc.berlios.de/ to check their support documentation or e-mail ...
    (SuSE)
  • Re: Error rendering
    ... initialize the camera and vier matrix before. ... > It's impossible to say without more detailed information. ...
    (microsoft.public.win32.programmer.directx.graphics)