This one is driving me crazy.
The Windows Mobile 6 sample CameraCapture works fine on all WM 6 devices tested. I have added the same graph construction to a large complex program. On some devices, the CLSID_VideoCapture filter fails to accept the camera name through the IPersistPropertyBag::Load() interface call and returns E_INVALIDARG (0x80070057).
My program works fine on one WM 6.5 device, so I think the camera name is being delivered properly t开发者_开发技巧o the filter. There seems to be some external conflict which prevents the camera from being associated with the filter on some devices. Failures occur on both WM 6.1 and WM 6.5 devices.
I've checked and stepped through this many times, but can't find any culpable difference between the trivial sample CameraCapture (which always works) and my complex program (which only works on one device). Here are some more details:
- All work is done on the main thread (CameraCapture uses a helper thread, but behaves the same if graph construction is done on the main thread).
- E_INVALIDARG is not listed as a possible return value from IPersistPropertyBag::Load(). I think the error comes from some internal aspect of the camera initialization.
- If I pass a bad camera name like "CAM" I get 0x80070002, "device/file not found". With no name in the bag I get 0x8007000d "The data is invalid".
- I have implemented a CErrorLog for the Load( &PropBag, &ErrorLog ) and it is never called during the Load(), so there are no more details available.
- Compilation and linking settings are roughly the same between the two programs.
- Both programs use CoInitializeEx( NULL, COINIT_MULTITHREADED ) and the complex program works fine on one device.
- The camera selection in both CameraCapture and my program are nearly identical to the description here: http://msdn.microsoft.com/en-us/library/aa918757.aspx
- I've found one other mention of this problem: http://www.eggheadcafe.com/software/aspnet/30318752/problem-with-propertybag.aspx
Any thoughts about what the error really means or what conflicts could cause this are appreciated.
Thanks.
As suspected, I found an external conflict. All my devices have barcode scanners. On some, there is a conflict between the scanners and the camera. Of course, the CameraCapture sample does not contain any scanner control so it always works. The devices are probably sharing some interface hardware to save a dollar and thereby crippling the usability. Now I just need to work out some exclusive sharing.
精彩评论