none
Disable and Enable WiFi connection

    Question

  • I have a problem in enabling the WiFi connection after disable it by my app.

    To disable( which is done successfully)

    SavePowerState.pwcAdapterName = AdapterName;
    SavePowerState.CePowerState   = D4;

    DeviceIoControl(hNdisPwr,IOCTL_NPW_SAVE_POWER_STATE,&SavePowerState,sizeof(NDISPWR_SAVEPOWERSTATE),NULL,0x00,NULL,NULL);

    if (DeviceIoControl(NDISHandle, IOCTL_NDIS_REBIND_ADAPTER,multiSz, sizeof(multiSz),NULL, 0,&BytesReturned, NULL) == 0)
     {
      RETAILMSG(1, (L"Cannot rebound adapter", L"Error", MB_OK));
      return;
     }

    To enable, I try to do more or less the same as the above by changing the PowerState to D0(high power level). However, it cant work. Do anybody know how to enable the wireless connection by app.??

    Thanks a lot~~~

    Monday, March 12, 2007 7:55 AM

Answers

  • Dear namllat,

    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

    Monday, March 12, 2007 9:47 AM

All replies

  • Dear namllat,

    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

    Monday, March 12, 2007 9:47 AM
  • Dear Zero

    Thanks a lot~~ It works perfectly.

    Howerver, I found that if I disable the connection manually, then it can't be enabled by software app. Is it a normal behaviour?

    Tuesday, March 13, 2007 4:25 AM
  • hi all,

    Could u help me how to configure / manage WiFi device on pocket PC through C#, actually i read this thread but i don't know how to start to code. may be u all guys could give me a sample code to turn ON/OFF WiFi completely, if u don't mind, becouse i'm newbie on this. btw i just wanna use this code for my own PDA.

    thanx alot
    A.M
    Thursday, January 03, 2008 8:01 AM
  • Hi all,

     

    I am also new to pocket pc, please can you show us more about the codes to disable and enable wifi connection.

    Thank a million in advanced.

     

    Sam

     

    Wednesday, March 12, 2008 6:05 PM
  • can you post all the code ?  i looking for enable/disable WIFI on windows-ce .

    thanks in advance

    Friday, January 28, 2011 8:58 AM