Re: CoCreateInstance() returns E_OUTOFMEMORY



On Jan 31, 11:33 pm, "Brian Muth" <bm...@xxxxxxxx> wrote:
"Bala L" <balasubramania...@xxxxxxxxx> wrote in messagenews: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

Yes, CoInitialize() is called in the InitInstance(). If it wasn't
being called, then I would expect the program to fail on the other
computer as well. It runs fine on a single laptop, and fails on 2-3
other computers I've tried.
.



Relevant Pages

  • Re: CoCreateInstance() returns E_OUTOFMEMORY
    ... exposed through a .dll file. ... It runs fine on a single laptop, ... registering these files in the desktop, I am now able to run the ... The live display of the camera image ...
    (microsoft.public.vc.mfc)
  • Re: Laptop wont start - missing dll file
    ... I managed to delete a dll file: ATGinahook.dll which caused the laptop ... I would do this but upon Windows loading from CD, the installer tells ... F6 and a floppy with the right drivers. ...
    (uk.comp.homebuilt)
  • Re: Laptop wont start - missing dll file
    ... I managed to delete a dll file: ATGinahook.dll which caused the laptop ... Typing that path straight in to explorer ... F6 and a floppy with the right drivers. ...
    (uk.comp.homebuilt)
  • Re: .dll file help
    ... MVP - Windows Shell/User ... Please reply to the News Groups ... > When my laptop is first starting up, I get a messagae saying:"you are ... > attempting to open a .dll file. ...
    (microsoft.public.windowsxp.help_and_support)