OleCreatePropertyFrame - Same Code Fails on Vista but not on XP.
- From: Handy13 <Handy13@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 28 Jun 2008 14:19:01 -0700
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;
}
.
- Prev by Date: How to insert ActiveX control in web page dynamically?
- Previous by thread: How to insert ActiveX control in web page dynamically?
- Index(es):
Relevant Pages
|