2013年6月14日 星期五

How to autorun program when plug-in SD card on WinCE

1. 使用 notification API 製作呼叫程式,用來註冊當 SD card 插入時,要執行的程式。
    #include Notify.h
    void wmain(void)
    {
       // 預計執行的程式
       CeRunAppAtEvent(_T("\\windows\\peghelp.exe");
       // card detect even
       NOTIFICATION_EVENT_DEVICE_CHANGE);
    }
2. 當系統開機時執行此程式,用於註冊notification event。
3. 當插入SD card後,OS將自動執行"peghelp.exe"。

P.S. 此方式不適用於自動執行位於SD card內的程式。
       因為執行程式的動作會在將SD card mount到file system之前。

沒有留言:

張貼留言