Click here to Skip to main content
15,742,655 members
Please Sign up or sign in to vote.
2.20/5 (3 votes)
See more:
i want to detect the mobile blutooth (device) when it is in range of my laptop bluetooth and lock the laptop when mobile goes out of range.

i searched online but i didnt get anything realeted , as how to go about it

while searching i came across but i dont know how to work with it

please help me
Mehdi Gholam 6-Sep-14 2:16am    
Try reading the documentation on the codeplex site first.

1 solution

First I need to say that I never tried this myself, but this is the way I would approach the problem.
This is not a ready solution, but should give you some help forward. There might be more steps I have not thought of.

1. Pair your Bluetooth device with your PC.

2. Implement code to detect paired devices.
This link explains how to find Serial COM ports (including BT devices)
It should be possible to modify the code so you can find paired BT devices only.
Finding Bluetooth paired NXTs with WMI[^]

3. Identify your device.

4. Use polling to see if your device exist in the list or not and is connected.
Polling is easy to implement, but you should do it in a thread so it can be easily aborted.
If the API provides events when devices appears or disappears it is preferable to use the events but I don't know if there is any. You have to read for yourself.

5. If exists, unlock computer; else, lock computer.

This page is for Windows 8 Bluetooth API. I hope it will be helpful.
Bluetooth API[^]

Here is another link using 32feet.NET that should work for Windows 7
Working With Bluetooth Devices Using C# – Part 1[^]

You can decide to implement this as a Windows service that starts automatically when your computer starts or a regular EXE that you start yourself.

Good luck with your project.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900