[VB.NET] Windows 8 Sensors

If you have completed an application and wish to share the complete source/project files with everyone then please post it in here. Source-code files only, no tutorials.
8 posts Page 1 of 1
Contributors
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

[VB.NET] Windows 8 Sensors
comathi
A while back I had to make an end of year project for my IT class and I chose to make a (somewhat believable) clone of the popular mobile game Temple Run. Since we could use Windows tablets instead of the desktop if we wanted, I decided to challenge myself further and use the available sensors on the tablet to control part of the game.

Trouble is, though, that we were using Xojo (formerly known as REALbasic) to develop our applications. It's great and all, but it does not by default support the Windows 8 sensors. VB.NET, on the other hand, does, and Xojo allows you to import DLLs written in another language and use their functions.

So I developped a DLL with a few functions that interface with the different sensors available on a Windows tablet (accelerometer, compas, gyrometer, inclinometer and light sensor). Each function returns a String, but you could easily modify them to return any type of data you wish... I chose String because it worked best with Xojo.

Anyway, I thought I might post the source here, in case you too need these functions outside of a .NET language. Enjoy ;)
You do not have the required permissions to view the files attached to this post.
User avatar
smashapps
Coding Guru
Coding Guru
Posts: 961
Joined: Tue Apr 05, 2011 8:41 am

Re: [VB.NET] Windows 8 Sensors
smashapps
I don't have a use for this since I don't use a tablet that this is really cool. Did it take you long?

#Birthday
My name is Tom | Visit my blog where I post new content every day! Tom's Daily Blog | MineCraft is awesome!
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: [VB.NET] Windows 8 Sensors
Dummy1912
wow cool
thanks for sharing never knew this was even possible in vb ;)

can this even used without having win8?

#Birthday
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

Re: [VB.NET] Windows 8 Sensors
comathi
#smashapps,

The research was the longest part lol. I probably spent close to three weeks looking for ways to use external code in Xojo. Once I found out how, it was very easy to write the DLL, since Microsoft has very good documentation on the subject :)

#Dummy1912,

Unfortunately, this DLL can only be used on Windows 8 because it references system DLLs that are only present in Windows 8.

If you try to use the DLL on something other than Windows 8, it might throw an exception, so you'd better make your program check the Windows version before calling functions.

Thanks guys :)

#Birthday
User avatar
Shim
VIP - Donator
VIP - Donator
Posts: 882
Joined: Wed Dec 14, 2011 5:02 am

Re: [VB.NET] Windows 8 Sensors
Shim
Can you post examples? please
Find my programs on Softpedia
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

Re: [VB.NET] Windows 8 Sensors
comathi
Sure! What exactly do you want examples of, though? :lol:
User avatar
Shim
VIP - Donator
VIP - Donator
Posts: 882
Joined: Wed Dec 14, 2011 5:02 am

Re: [VB.NET] Windows 8 Sensors
Shim
usage of the DLL
Find my programs on Softpedia
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

Re: [VB.NET] Windows 8 Sensors
comathi
Well that would depend what you're using it in... The DLL is made to be used outside of .NET langugaes, obviously, because .NET already supports the functions available in the DLL.

So say, for example, that you're using Xojo, all you would have to do is import the DLL and reference one of the functions it contains, then you'll be able to call it anywhere in your program.

If you mean how to use the functions, that's all detailled in the source code.
8 posts Page 1 of 1
Return to “Source-Code”