Hi.. we are doing an game for our assignment.. we would want to know how to make a phone vibrate when the result turns win or lose.. and we also want to know if there is a way to set the backlight turn off or on (within the game)..
Could anybody help us with this.. by the way.. we are doing this program in vb.net..
Thanks.
Making a Phone Vibrate using VB.NETIn need of finding API
Page 1 of 1
5 Replies - 4608 Views - Last Post: 23 July 2009 - 06:25 AM
Replies To: Making a Phone Vibrate using VB.NET
#2
Re: Making a Phone Vibrate using VB.NET
Posted 20 July 2009 - 10:15 AM
Assuming you are using windows mobile, since it's VB.net.
It's fairly easy to make it work, the hard part was finding the actual API.
Windows mobile 5/6 vibration was moved to the LED API which makes it obscure to find.
The code I use in my app is this
On most devices the vibration is set to LED device 1.
For more information on the API go here http://msdn.microsof...y/ms923732.aspx
As for turning off the backlight, that's easy as well.
Information on it can be found here http://msdn.microsof...y/aa455153.aspx
It's fairly easy to make it work, the hard part was finding the actual API.
Windows mobile 5/6 vibration was moved to the LED API which makes it obscure to find.
The code I use in my app is this
Private Structure NLED_SETTINGS_INFO
Public LedNum As Integer
Public OffOnBlink As Integer
Public TotalCycleTime As Integer
Public OnTime As Integer
Public OffTime As Integer
Public MetaCycleOn As Integer
Public MetaCycleOff As Integer
End Structure
<DllImport("Coredll")> _
Private Shared Function NLedSetDevice(ByVal deviceId As Integer, ByRef info As NLED_SETTINGS_INFO) As Boolean
End Function
Private Shared Sub SetVibrate(ByVal state As Boolean)
Dim info As New NLED_SETTINGS_INFO()
info.LedNum = 1
info.OffOnBlink = If(state, 1, 0)
NLedSetDevice(1, info)
End Sub
On most devices the vibration is set to LED device 1.
For more information on the API go here http://msdn.microsof...y/ms923732.aspx
As for turning off the backlight, that's easy as well.
Information on it can be found here http://msdn.microsof...y/aa455153.aspx
#3
Re: Making a Phone Vibrate using VB.NET
Posted 21 July 2009 - 12:57 AM
Mezius, on 20 Jul, 2009 - 09:15 AM, said:
Assuming you are using windows mobile, since it's VB.net.
It's fairly easy to make it work, the hard part was finding the actual API.
Windows mobile 5/6 vibration was moved to the LED API which makes it obscure to find.
The code I use in my app is this
On most devices the vibration is set to LED device 1.
For more information on the API go here http://msdn.microsof...y/ms923732.aspx
As for turning off the backlight, that's easy as well.
Information on it can be found here http://msdn.microsof...y/aa455153.aspx
It's fairly easy to make it work, the hard part was finding the actual API.
Windows mobile 5/6 vibration was moved to the LED API which makes it obscure to find.
The code I use in my app is this
Private Structure NLED_SETTINGS_INFO
Public LedNum As Integer
Public OffOnBlink As Integer
Public TotalCycleTime As Integer
Public OnTime As Integer
Public OffTime As Integer
Public MetaCycleOn As Integer
Public MetaCycleOff As Integer
End Structure
<DllImport("Coredll")> _
Private Shared Function NLedSetDevice(ByVal deviceId As Integer, ByRef info As NLED_SETTINGS_INFO) As Boolean
End Function
Private Shared Sub SetVibrate(ByVal state As Boolean)
Dim info As New NLED_SETTINGS_INFO()
info.LedNum = 1
info.OffOnBlink = If(state, 1, 0)
NLedSetDevice(1, info)
End Sub
On most devices the vibration is set to LED device 1.
For more information on the API go here http://msdn.microsof...y/ms923732.aspx
As for turning off the backlight, that's easy as well.
Information on it can be found here http://msdn.microsof...y/aa455153.aspx
Thanks.. we did try implementing it.. but there was a error with "<DllImport("Coredll")>" we did try add reference.. but the coredll is not being found.. could u guide me of how to add refrence in vb step by step..
Thanks..
This post has been edited by fizarah.parveen: 21 July 2009 - 01:14 AM
#4
Re: Making a Phone Vibrate using VB.NET
Posted 22 July 2009 - 04:57 AM
The reference is system.core, it should be in the list of references you can choose on the .Net tab when adding a reference.
This post has been edited by Mezius: 22 July 2009 - 05:04 AM
#5
Re: Making a Phone Vibrate using VB.NET
Posted 22 July 2009 - 08:33 PM
Mezius, on 22 Jul, 2009 - 03:57 AM, said:
The reference is system.core, it should be in the list of references you can choose on the .Net tab when adding a reference.
Hey thanks.. but I couldnt find that particular reference..
System
System.data
System.data.sqlClient
System.data.sqlserverce
System.Drawing
System.Messaging
System.Net.IrDA
System.web.Services
System.Windows.Forms
System.Windows.Forms.DataGrid
System.XML
This are those could be found.. is there any other reference could be used... i even tried searching the web for the system.core it gave for the windows.. (for computer)
#6
Re: Making a Phone Vibrate using VB.NET
Posted 23 July 2009 - 06:25 AM
You are using windows mobile correct?
If so, make sure you have the SDK's installed correctly for 5/6 and make sure you have .net 2 and 3.5 sdk's installed.
First thing I do is install VS 2008 which includes the .net SDKs and the windows mobile SDKs, so I'm not sure which one you really need. It should be the windows mobile ones because it's the core of the OS.
Try manually adding the reference through browsing - the file on mine is in C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE
If so, make sure you have the SDK's installed correctly for 5/6 and make sure you have .net 2 and 3.5 sdk's installed.
First thing I do is install VS 2008 which includes the .net SDKs and the windows mobile SDKs, so I'm not sure which one you really need. It should be the windows mobile ones because it's the core of the OS.
Try manually adding the reference through browsing - the file on mine is in C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE
This post has been edited by Mezius: 23 July 2009 - 06:26 AM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|