2009年3月8日 星期日

開啟/關閉 WIFI 裝置

問題
http://topic.csdn.net/u/20080728/20/a5efe62a-629c-4811-add5-bc6c53fcdd5b.html

解法

Windows Mobile 中开关 WIFI 的“通用”代码

SystemState.WiFiStatePowerOn Property  讀取WIFI狀態的屬性,但無法設置開關
英文的 ><

Deactivate /Activate all Services like (Internet,WIFI,Bluetooth,WLAN..)

Enabling Radio in the Windows Mobile 5.0

WiFi Power On Event

開啟D0 關閉D4

We can implement this functionality with ease. Hope this can give your some idea.

See the code below:

// D0 indicates open; D4 indicates close;

CEDEVICE_POWER_STATE state = D0;

HRESULT hr = SetDevicePower(TEXT(""),POWER_NAME,state);

Note: We use SetDevicePower function here. It sets the device power state for a device.

  1. 1st parameter: specify the device.
  2. 2nd parameter: we use POWER_NAME here to indicate that the first parameter is just a device name.
  3. 3rd parameter: sets the power state.

In order to get information in details, you can find it in MSDN. Thanks!

Regards,

Zero Dai - MSFT



之後
Battery Status

GPS Application

Mobile GPS

沒有留言:

張貼留言

try comments