|
|
|
date: Sat, 28 Jun 2008 14:19:01 -0700,
group: microsoft.public.win32.programmer.ole
back
OleCreatePropertyFrame - Same Code Fails on Vista but not on XP.
Hi,
HELP!
I am a highly experienced software engineer but I am stumped by some
peculiar behavior associated with the âPhilips SPC 900NC PCâ webcam.
Below is a test case. I compiled it both on XP and on Vista. The
executables run without any problem on XP but there is a catastrophic failure
that occurs on Vista. Unfortunately, you need a the âPhilips SPC 900NC PCâ
webcam to see the problem.
When TestProp is executed, the âPropertiesâ window is displayed. Works fine
on Vista and XP. The âPropertiesâ window has three tabs, âGeneralâ, âVideoâ
and âAudioâ. Clicking on each tab works fine and displays the right stuff on
XP. The first two tabs work fine on Vista but when you click on the third
tab, âVideoâ, you get the message :
âUnhandled exception at 0x691275a3 in HandyAvi.exe: 0xC0000005: Access
violation reading location 0xc0c0c0c0.â
The stack trace says:
CamExt40V32.ax.6a7175a3()
[Frames below may be incorrect and/or missing, no symbols loaded for
CamExt40V32.ax]
Ntdll.dll!_RtlInsertElementGenericTableFullAvl@24() + 0x91 bytes
Ntdll.dll!_RtlDebugFreeHeap@12() + 0x2f bytes
Yes, there is probably something âdifferentâ about the Philips driver.
Other webcams do not exhibit any problems but I need to crashproof my
application. Canât have my application crashing just because the hapless
user clicks on some third-party âPropertiesâ tab.
GraphEdit has no problem displaying the Audio Properties tab in either XP or
Vista.
GraphEditPlus has no problem displaying the Audio Properties tab in either
XP or Vista.
VirtualDub has the same problem my application has. Crashes on Vista when
the Audio tab is selected.
GraphStudio âhangsâ when it tries to display the Properties window on the
following statement:
HRESULT hr = page->Activate(owner, &rc, FALSE);
And yes, I tried the GraphStudio downloadable executable as well as
downloading the source and compiling it and testing it myself to see where it
was hangingâ¦
Wish I had source code for the real GraphEdit or for GraphEditPlus to see
what they know that I donât know.
So what am I overlooking?
How do I crashproof my application? (I tried making the code a separate
thread but it still crashed my whole application. I tried try-catch on (â¦)
but it didnât catch the error. I tried to use __try but the compiler mumbled
something about unwinding something and refused to compile it. This stuff is
really whackoâ¦)
So here is source code that will display the problem. Remember, you do need
a "Philips SPC 900NC PC Camera" webcam to see the problemâ¦
int CTimeLapseDlg::TestProp()
{
CComPtr< IGraphBuilder > pGraph;
CComPtr< IBaseFilter > pVideoInputFilter;
// Initialize the COM library.
HRESULT hr = CoInitialize(NULL);
if (FAILED(hr))
{
printf("ERROR - Could not initialize COM library");
return hr;
}
// Get the video input filter for the webcam
hr = GetVideoInputFilter(&pVideoInputFilter, L"Philips SPC 900NC PC
Camera");
if (SUCCEEDED(hr)) {
//SHOW THE FILTER PROPERTY PAGES
ShowFilterPropertyPages(pVideoInputFilter);
}else{
printf("Could not find 'Philips SPC 900NC PC Camera'");
}
if(pVideoInputFilter) pVideoInputFilter.Release();
CoUninitialize();
return 0;
}
// SHOW THE PROPERTY PAGES FOR A FILTER
HRESULT CTimeLapseDlg::ShowFilterPropertyPages(IBaseFilter *pFilter) {
/* Obtain the filter's IBaseFilter interface. (Not shown) */
ISpecifyPropertyPages *pProp;
HRESULT hr = pFilter->QueryInterface(IID_ISpecifyPropertyPages, (void
**)&pProp);
if (SUCCEEDED(hr))
{
// Get the filter's name and IUnknown pointer.
FILTER_INFO FilterInfo;
hr = pFilter->QueryFilterInfo(&FilterInfo);
IUnknown *pFilterUnk;
pFilter->QueryInterface(IID_IUnknown, (void **)&pFilterUnk);
// Show the page.
CAUUID caGUID;
pProp->GetPages(&caGUID);
OleCreatePropertyFrame(
NULL, // Parent window
0, 0, // Reserved
FilterInfo.achName, // Caption for the dialog box
1, // Number of objects (just the filter)
&pFilterUnk, // Array of object pointers.
caGUID.cElems, // Number of property pages
caGUID.pElems, // Array of property page CLSIDs
0, // Locale identifier
0, NULL // Reserved
);
// Clean up.
pProp->Release();
if(pFilterUnk)pFilterUnk->Release();
if(FilterInfo.pGraph) FilterInfo.pGraph->Release();
if(caGUID.pElems)CoTaskMemFree(caGUID.pElems);
}
return hr;
}
date: Sat, 28 Jun 2008 14:19:01 -0700
author: Handy13
|
|