close

Apply to: Windows Embedded CE

Autorun when plugging SD card.

請參考以下步驟:

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 之前.

arrow
arrow
    全站熱搜

    sherwintech 發表在 痞客邦 留言(0) 人氣()