I have to check if the Airplane Mode is enabled in Windows 8 and maybe switch its state. I am currently working on a C# .NET 4.0 Windows Forms application but the answers in this question shouldn't be limited by that.
相关问题
- the application was unable to start correctly 0xc0
- Handle button click in another application
- win32 Python - pythoncom error - ImportError: No m
- How to prevent windows from accessing and detectin
- Getting the output from a process created by Creat
相关文章
- Why windows 64 still makes use of user32.dll etc?
- Can WM_NEXTDLGCTL be used with non-dialog windows?
- Windows EventLog: How fast are operations with it?
- Are resource files compiled as UNICODE or ANSI cod
- New Windows Application - What language?
- user32 and kernel method list for C# [closed]
- Writing to the middle of the file (without ove
- Does winapi's bcrypt.h actually support bcrypt
Here is a code snippet to get the NetworkConnectivityLevel which will likely give you what you need to know. I don't know if there is a way to change it. I would doubt it because you would need to also provide a way to pick a network to connect to.
Unfortunately, there isn't a programmatic way for Metro apps to change the airplane mode in Windows 8. It is against the Metro guidelines for an application to go outside its sandbox and modify system settings like this without user permission (see the discussion at http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/1ad10725-b1b8-4723-b2c3-861900809e02).
Now, you may be able to figure out the status by using some of the functionality in the Windows.Networking.NetworkOperators namespace. Specifically, check out the MobileBroadbandRadioState and NetworkDeviceStatus enumerations.
Or, you could prompt the user to make the change by explaining how to access the setting using Windows Key + I, Change PC Settings, Wireless, Airplane Mode.