ChrisL Posted July 15, 2008 Posted July 15, 2008 (edited) This is how you do it.. Local $dllCallError[4] = [3,"unable to use the DLL file","Unknown return type","Function not found in the Dll file"] $dll = DllCall("btfunc.dll","dword:cdecl","BT_IsBlueSoleilStarted","long",2);2 second timeout return if not started If @error then Msgbox(0,"Error in Dll call", $dllCallError [@error]) ElseIf $dll[0] = 1 then Msgbox(0,"","BlueSoliel Started") Else Msgbox(0,"","BlueSoliel NOT Started") EndIf Edit: Added the dllcallError array Edited July 15, 2008 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
ChrisL Posted July 15, 2008 Posted July 15, 2008 Here is a couple more to get you started Local $dllCallError[4] = [3,"unable to use the DLL file","Unknown return type","Function not found in the Dll file"] $handle = DllOpen("btfunc.dll") $dll = DllCall($handle,"dword:cdecl","BT_InitializeLibrary") If @error then Msgbox(0,"Error in Dll call", $dllCallError[@error]) ElseIf $dll[0] = 1 then Msgbox(0,"","BlueSoliel Initialized") Else Msgbox(0,"","BlueSoliel Failed to initialize") EndIf $dll = DllCall($handle,"dword:cdecl","BT_IsBlueSoleilStarted","long",2);2 second timeout return if not started If @error then Msgbox(0,"Error in Dll call", $dllCallError[@error]) ElseIf $dll[0] = 1 then Msgbox(0,"","BlueSoliel is Started") Else Msgbox(0,"","BlueSoliel NOT Started") EndIf $dll = DllCall($handle,"dword:cdecl","BT_GetVersion","dword",0) If @error then Msgbox(0,"Error in Dll call", $dllCallError[@error]) Else Msgbox(0,"BlueSoliel Version",$dll[0]) EndIf DllClose($handle) [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
7h331337 Posted July 15, 2008 Author Posted July 15, 2008 @chrisl if u dont mind me askin can u tell me what u use the :cdecl for thanks again
7h331337 Posted July 15, 2008 Author Posted July 15, 2008 (edited) @chrisl if u dont mind me askin can u tell me what u use the :cdecl for and y dos this not work $dll = DllCall("btfunc.dll", "dword:cdecl", "BT_InquireDevices", "long", 2) thanks again Edited July 15, 2008 by 7h331337
ChrisL Posted July 15, 2008 Posted July 15, 2008 I used cdecl because that is what is needed, if you don't it crashes. Look at dllcall inthe help file. I'll have a look at the other thing either later or tomorrow, I've got 3 kids running round at the moment so I can't really do it, the other problem I've got is I've loaded the IVT software but I don't actually have a Bluetooth dongle so I'm limited as to what I can do. [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
7h331337 Posted July 15, 2008 Author Posted July 15, 2008 thank u so mutch chris this has been muttley for me lol
ChrisL Posted July 15, 2008 Posted July 15, 2008 (edited) thank u so mutch chris this has been muttley for me lol I'm not convinced this is right.. I keep getting an error but it could be that I don't have a Bluetooth dongle.. or more likely I don't really understand the dllStruct stuff properly. There are a couple of values that don't seem to be difined in the API document, so maybe there is another header file kicking around that contains those values? Global const $DEVICE_ADDRESS_LENGTH = 6 Global const $DEVICE_CLASS_LENGTH = 3 Global const $MAX_DEVICE_NAME_LENGTH = 64 $str = "DWORD;byte[" & $DEVICE_ADDRESS_LENGTH & "];byte[" & $DEVICE_CLASS_LENGTH & "];char[" & $MAX_DEVICE_NAME_LENGTH & "];int" $struct_BLUETOOTH_DEVICE_INFO = DllStructCreate($str) $lpDevsListLength = DllStructCreate("DWORD") $dll = DllCall($handle,"dword:cdecl","BT_InquireDevices","char","INQUIRY_GENERAL","char",0x30,"long*",DllStructGetPtr($lpDevsListLength),"long*",DllStructGetPtr($struct_BLUETOOTH_DEVICE_INFO)) If @error then Msgbox(0,"Error in Dll call", $dllCallError[@error]) Else _arrayDisplay($dll,"BT_InquireDevices") EndIf Edit: this is what the API doc said, maybe one of the cleverer people can figure out what is wrong 5.15 BT_InquireDevices This function inquires nearby Bluetooth devices or gets paired devices from BlueSoleil’s history records. DWORD BT_InquireDevices( /* [in] */ UCHAR ucInqMode, /* [in] */ UCHAR ucInqTimeLen, /* [in, out] */ DWORD* lpDevsListLength, /* [out] */ PBLUETOOTH_DEVICE_INFO pDevsList, ); Parameters ucInqMode [in] Specifies the inquiry mode: Value Meaning INQUIRY_GENERAL Inquires using general-discovery mode INQUIRY_LIMITED Inquires using limited-discovery mode INQUIRY_PAIRED Gets paired devices from history list without performing Bluetooth inquiry. INQUIRY_GENERAL_REFRESH Inquires using general-discovery mode, clears devices in memory before performing the inquiry. ucInqTimeLen [in] Maximum amount of time before the inquiry is halted. Range: 0x01 – 0x30 Time = N * 1.28 sec Range: 1.28 – 61.44 Sec. lpDevsListLength [in,out] Pointer to a variable that specifies the length of the buffer pointed by lpDevsList, after the function returns, the variable receives the length of data copied to the buffer. If value (*lpDevsListLength) is zero, the function returns immediately after Bluetooth inquiry is started, inquiry results will be reported if callback function for EVENT_INQUIRY_DEVICE_REPORT is registered. lpDevsList [out] Pointer to a BLUETOOTH_DEVICE_INFO array buffer that receives the device information. This parameter can be NULL if (*lpDevsListLength) is zero.. Return Values BTSTATUS_SUCCESS if the function succeeds. BTSTATUS_PARAMETER_ERROR if parameter(s) is error. BTSTATUS_SYSTEM_ERROR if system error(s) occurs. BTSTATUS_BT_NOT_READY if Bluetooth is not started. Edited July 15, 2008 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
7h331337 Posted July 15, 2008 Author Posted July 15, 2008 ye i get it saying unable to use the DLL file but i put the dll in the same dir as script is this the problem u got chris
ChrisL Posted July 15, 2008 Posted July 15, 2008 ye i get it saying unable to use the DLL file but i put the dll in the same dir as script is this the problem u got chris Yes but it's nothing to do with the location of the dll, because it works OK on the other functions and I used the same handle. It is the struct(s) that are wrong I'm pretty sure about that.. This is what the doc says about the struct typedef struct _BLUETOOTH_DEVICE_INFO { DWORD dwSize; BYTE address[DEVICE_ADDRESS_LENGTH]; BYTE classOfDevice[DEVICE_CLASS_LENGTH]; CHAR szName[MAX_DEVICE_NAME_LENGTH]; BOOL bPaired; } BLUETOOTH_DEVICE_INFO, *PBLUETOOTH_DEVICE_INFO; Members dwSize Size of the structure, in bytes. address Address of the device. classOfDevice Class of the device. szName A null-terminated string specifying the Bluetooth device name. bPaired Specifies whether the device is paired, authenticated or bonded. All authenticated devices are remembered. [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
7h331337 Posted July 15, 2008 Author Posted July 15, 2008 (edited) i just found this in the api do i need to call all of these (on page 5) 7. Typical API Calling Sequence: 1) BT_InitializeLibrary 2) BT_RegisterCallback 3) BT_InquireDevices 4) BT_PairDevice 5) BT_BrowseServices 6) BT_ConnectService 7) BT_DisconnectService 8) BT_UninitializeLibrary Edited July 16, 2008 by 7h331337
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now