监听照相机拍照功能

http://wiki.forum.nokia.com/index.php/How_use_NotifyChange_to_get_camera_clicks Does your application need a notification whenever a photo is clicked through the camera application? Well, here is how you can achieve it. The following article shows how your application can get a notification as soon as a photo is clicked and stored in the Phone memory, i.e., the C:/Nokia/Images folder. It is achieved using the NotifyChange API of the RFs server. Remember to include PlatformEnv.lib in your mmp file if you are using the PathInfo API's Library needed: LIBRARY PlatformEnv.lib Source: #ifndef _NOTIFY_C_ #define _NOTIFY_C_ #include #include #include "MyDirObserver.h" class CMyCNotify : public CActive { public: CMyCNotify(RFs& aFs, MDirObserver& aDirObserver); ~CMyCNotify(); void StartMonitoring(); public: // CActive void RunL(); void DoCancel(); private: RFs& iFs; MDirObserver& iDirObserver; }; #endif #include #include #include "MyCNotify.h" CMyCNotify::CMyCNotify(RFs& aFs, MDirObserver& aDirObserver) : CActive(EPriorityStandard), iFs(aFs), iDirObserver(aDirObserver) { CActiveScheduler::Add(this); } CMyCNotify::~CMyCNotify() { Cancel(); } void CMyCNotify::RunL() { if(iStatus==KErrNone) { iDirObserver.CChange(); StartMonitoring(); } else ; // there was an error so all monitoring will now stop } void CMyCNotify::DoCancel() { iFs.NotifyChangeCancel(iStatus); } void CMyCNotify::StartMonitoring() { if(!IsActive()) { TFileName path = PathInfo::PhoneMemoryRootPath(); path.Append(PathInfo::ImagesPath()); iFs.NotifyChange(ENotifyWrite, iStatus, path); SetActive(); } else ; // already waiting for a change so do nothing } and finally implement the interface #ifndef _DIROBSERVER_H_ #define _DIROBSERVER_H_ class MDirObserver { public: virtual void CChange() = 0; virtual ~MDirObserver(){} }; #endif
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值