Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在windows xp c#代码上启用/禁用蓝牙_C#_Visual Studio_Bluetooth - Fatal编程技术网

在windows xp c#代码上启用/禁用蓝牙

在windows xp c#代码上启用/禁用蓝牙,c#,visual-studio,bluetooth,C#,Visual Studio,Bluetooth,我发现,但我想要的,是可以控制WindowsXP蓝牙的代码。使用C代码打开或关闭它。在短暂的“谷歌搜索”后,我发现: 不要让“收音机”这个词误导你 如果它应该在台式pc上运行,您可以使用,但该代码仅适用于windows mobile。。。我需要示例代码在我的windows xp上显示蓝牙启用/禁用。我可能希望代码可以在不使用windows mobile reference的情况下使用。@rose:您正在桌面计算机上寻找解决方案?我的意思是在笔记本电脑上的windows xp上。。。yes@ros

我发现,但我想要的,是可以控制WindowsXP蓝牙的代码。使用C代码打开或关闭它。

在短暂的“谷歌搜索”后,我发现:

不要让“收音机”这个词误导你


如果它应该在台式pc上运行,您可以使用

,但该代码仅适用于windows mobile。。。我需要示例代码在我的windows xp上显示蓝牙启用/禁用。我可能希望代码可以在不使用windows mobile reference的情况下使用。@rose:您正在桌面计算机上寻找解决方案?我的意思是在笔记本电脑上的windows xp上。。。yes@rose:我在回答中为您添加了一个有用的链接。示例试用代码有一个限制,它只能在我的笔记本电脑上检测蓝牙的开启或关闭,但无法开启或关闭蓝牙。
[DllImport("BthUtil.dll")]
private static extern int BthSetMode(RadioMode dwMode );

[DllImport("BthUtil.dll")]
private static extern int BthGetMode(ref RadioMode dwMode );


/// Bluetooth states.
public enum RadioMode
{
   /// Bluetooth off.
   Off,
   /// Bluetooth is on but not discoverable.
   On,
   /// Bluetooth is on and discoverable.
   Discoverable,
}