09年智手各组组长,组员重新招募中 发贴得礼品有实物,有金币和道具 重新招募09年各版版主 每月获奖名单
新人报到加分贴 对我们的意见告诉这里 新增奖品及奖励办法 广告招商
 
发新话题
打印

请教:如何用VB.NET2003开关蓝牙?

请教:如何用VB.NET2003开关蓝牙?

请教:如何用VB.NET2003开关蓝牙?

TOP

主要是不知道在VB下如何调用bthutil.h描述的函数,请不吝赐教。
#pragma once

////////////////////////////////////////////////////////////////////////////////
//
// @enum    BTH_RADIO_MODE |
//          Enumerate all the possible modes of operation of the bluetooth radio
//
////////////////////////////////////////////////////////////////////////////////

enum BTH_RADIO_MODE
{
    BTH_POWER_OFF,
    BTH_CONNECTABLE,
    BTH_DISCOVERABLE
};

#ifdef __cplusplus
extern "C"{
#endif

////////////////////////////////////////////////////////////////////////////////
//
// @func    int | BthSetMode |
//          This function set the bluetooth Mode of operation and reflects it in
//          the control panel.  It also persist that state across hardware insertion
//          and reboot
//
// @syntax  BthSetMode( DWORD dwMode )
//
// @parm    DWORD | dwMode |
//          BTH_POWER_OFF to turn the bluetooth radio OFF
//          BTH_CONNECTABLE to turn the bluetooth radio ON and CONNECTABLE
//          BTH_DISCOVERABLE to turn the bluetooth radio ON and CONNECTABLE and DISCOVERABLE
//
// @rdesc   int: ERROR_SUCCESS on success.  Error code describing error on failure.
//
////////////////////////////////////////////////////////////////////////////////

int BthSetMode( DWORD dwMode );

////////////////////////////////////////////////////////////////////////////////
//
// @func    int | BthGetMode |
//          This function retrieves the current mode of operation of the bluetooth radio
//
// @syntax  BthGetMode( DWORD* pdwMode )
//
// @parm    DWORD* | pdwMode |
//          BTH_POWER_OFF to indicate the bluetooth radio is OFF
//          BTH_CONNECTABLE to indicate the bluetooth radio ON and CONNECTABLE
//          BTH_DISCOVERABLE to indicate the bluetooth radio ON and CONNECTABLE and DISCOVERABLE
//
// @rdesc   int: ERROR_SUCCESS on success.  Error code describing error on failure.
//
////////////////////////////////////////////////////////////////////////////////

int BthGetMode( DWORD* pdwMode );

#ifdef __cplusplus
}
#endif

TOP

这些是EVC下面的,可以用EVC做成DLL给VB.net程序调用。
欢迎来我的blog做客:http://lonemaverick.cnblogs.com

TOP

谢谢版主,ppc2003se的 windows目录下有bthutil.dll,包括了上面描述的函数,我不知道如何用VB调用,请指教。

TOP

主要是BthGetMode()这个函数。
1、声明:Declare Function BthGetMode Lib "bthutil.dll" Alias "BthGetMode" (ByRef mode As Integer, ByVal xmode As Integer) As Integer
调用BthGetMode(0, 1)始终返回0
2、声明:Declare Function BthGetMode Lib "bthutil.dll" Alias "BthGetMode" (ByRef mode As Integer) As Integer
调用BthGetMode(0)始终返回0
3、声明:Declare Function BthGetMode Lib "bthutil.dll" Alias "BthGetMode" () As Integer
调用BthGetMode()始终返回0

上述3种均无法检测蓝牙状态,请知道的大师指导一下上面错在哪儿?正确的是什么?

[ 本帖最后由 wshic 于 2006-5-22 23:02 编辑 ]

TOP

发新话题
版块跳转 
   京ICP备06029169号

本社区言论纯属发表者个人意见  与 智手移动中文网论坛 立场无关