سؤال

i'm working with VS2012, Windows Phone 8 SDK. I need to access the camera natively.

I have sucesfully created a PhotoCaptureDevice instance by calling PhotoCaptureDevice::OpenAsync, then get the opened device - mCaptureObject - with the help of create_task() and task.then().

however,

mCaptureObject->Close()

caueses compile error.

CameraStream.cpp(xxx): error C2039: 'Close' : is not a member of Windows::Phone::Media::Capture::PhotoCaptureDevice'

here's a link to msdn: PhotoCaptureDevice.Close()

i checked the photocapturedevice class declaration:

 public : virtual unknown-type Close() new sealed = Platform::IDisposable::Dispose
 Member of Windows::Phone::Media::Capture::PhotoCaptureDevice
 Summary:
 Releases resources that are associated with the capture device.

Any idea?

هل كانت مفيدة؟

المحلول

To call Close() on an object, you should invoke that object's destructor. This will happen naturally when the object no longer has references, or you can call delete mCaptureObject to force the destructor to run immediately. (If you do this while the object still has living references, those other references will be invalid and method calls should throw a DisconnectedException.)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top