How can I start the Bluetooth service (MS Stack) from code?
I've seen many snippets around the net about CreateFile and ControlIODevice
but none of them worked for me...
I'm using WinCE 6.0 with CF 2.0.
Thanks,
Alon
--
Luca Calligaris (MVP-Windows Embedded)
l.calliga...@eurotech.it.nospam
www.eurotech.it
"Alon" <Al...@discussions.microsoft.com> ha scritto nel messaggio
news:5A2027FA-1784-4CFB...@microsoft.com...
Thanks for your reply.
I'm actually programming for the first time to WinCE, till now I always
programmed to WinMO.
So, I have the WinMO 6 SDK (which does not hold that sample). Does the
sample path you wrote about is from WinCE SDK? Which version? I could locate
only WinCE 5.0 SDK in MS site that is from 2004. Can you post the link to
version 6.0?
Thanks,
Alon
--
vinoth.R
Aritcles:
http://www.windowsfordevices.com/articles/AT8185724467.html
http://e-consystems.com/gprsconnectivity.asp
http://vinoth-vinothblog.blogspot.com
http://www.e-consystems.com/blog
--
Luca Calligaris (MVP-Windows Embedded)
l.calliga...@eurotech.it.nospam
www.eurotech.it
"Alon" <Al...@discussions.microsoft.com> ha scritto nel messaggio
news:E97E0096-7CF2-46E1...@microsoft.com...
Also, is this sample in .Net or C++?
thanks,
Alon
It's in C/C++.
Paul T.
I'm running Win7 x64 with VS2008.
The Windows Embedded 6.0 SP1 wont install without VS2005...
Alon
For some refresh issues, I just notice your post...
So if not sending me the sample, can someone post here a .Net code snippet?
Thanks in advanced!!
Alon
http://msdn.microsoft.com/en-us/windowsembedded/ce/aa714519.aspx
--
Luca Calligaris (MVP-Windows Embedded)
l.calliga...@eurotech.it.nospam
www.eurotech.it
"Alon" <Al...@discussions.microsoft.com> ha scritto nel messaggio
news:0AECD6AE-B887-4EBB...@microsoft.com...
The issue is that those classes use the "bthutil.dll" which suppose to be
part on every standard WinCE image but of course, as "Murphy stopped by..."
on my PND it doesn't exist.
I will need a more 'source' code.
Maybe you know of a company that can develop it for me? I'm really desperate
and this project is way too important.
Thanks,
Alon
Class BTLoader2
Private Const FILE_DEVICE_SERVICE As UInt32 = &H104
Private Const METHOD_BUFFERED As UInt32 = 0
Private Const FILE_ANY_ACCESS As UInt32 = 0
<DllImport("coredll.dll")> _
Private Shared Function CreateFile(ByVal lpFileName As String, ByVal
dwDesiredAccess As UInteger, ByVal dwShareMode As UInteger, ByVal
lpSecurityAttributes As IntPtr, ByVal dwCreationDisposition As UInteger,
ByVal dwFlagsAndAttributes As UInteger, ByVal hTemplateFile As IntPtr) As
IntPtr
End Function
<DllImport("coredll.dll")> _
Private Shared Function DeviceIoControl(ByVal hDevice As IntPtr, ByVal
dwIoControlCode As UInt32, ByVal lpInBuf As IntPtr, ByVal nInBufSize As
UInt32, ByVal lpOutBuf As IntPtr, ByVal nOutBufSize As UInt32, ByRef
lpBytesReturned As UInt32, ByVal lpOverlapped As IntPtr) As UInt32
End Function
<DllImport("CoreDll.dll", EntryPoint:="GetLastError")> _
Private Shared Function GetLastError() As Integer
End Function
Private Shared Function IOCTL_SERVICE_START() As UInt32
Return CTL_CODE(FILE_DEVICE_SERVICE, 1, METHOD_BUFFERED,
FILE_ANY_ACCESS)
End Function
Private Shared Function CTL_CODE(ByVal DeviceType As UInt32, ByVal
[Function] As UInt32, ByVal Method As UInt32, ByVal Access As UInt32) As
UInt32
Return ((DeviceType) << 16) Or ((Access) << 14) Or (([Function]) <<
2) Or (Method)
End Function
Public Sub StartBT()
Dim hDev As IntPtr = CreateFile("BTD0:", CUInt(IO.FileAccess.Read Or
IO.FileAccess.Write), CUInt(IO.FileShare.Read Or IO.FileShare.Write),
IntPtr.Zero, 3, 0, IntPtr.Zero)
Dim BytesReturned As UInt32 = 0
Dim Result As UInt32 = DeviceIoControl(hDev, IOCTL_SERVICE_START(),
IntPtr.Zero, 0, IntPtr.Zero, 0, BytesReturned, IntPtr.Zero)
If Result <> 0 Then
MsgBox("Success")
Else
MsgBox(GetLastError, , "Error")
End If
End Sub
End Class
Paul T.