Discussion:
Want help regarding : "disable bluetooth device"
(too old to reply)
Devang
2008-03-31 12:49:33 UTC
Permalink
Hi

I want to disable bluetooth device connected to my PC.
Can I disble bluetooth radio connected to my PC through code (C++) ?

Thanking you

Regards
Devang Vyas
Ben Voigt [C++ MVP]
2008-03-31 22:33:02 UTC
Permalink
Post by Devang
Hi
I want to disable bluetooth device connected to my PC.
Can I disble bluetooth radio connected to my PC through code (C++) ?
Yes, using SetupDi* functions.
Post by Devang
Thanking you
Regards
Devang Vyas
Devang
2008-04-01 05:48:58 UTC
Permalink
Post by Ben Voigt [C++ MVP]
Post by Devang
Hi
I want to disable bluetooth device connected to my PC.
Can I disble bluetooth radio connected to my PC through code (C++) ?
Yes, using SetupDi* functions.
Post by Devang
Thanking you
Regards
Devang Vyas
Thank you very much for your valuable help
Devang
2008-04-07 08:30:53 UTC
Permalink
Post by Ben Voigt [C++ MVP]
Hi
I want todisablebluetoothdevice connected to my PC.
Can I disblebluetoothradio connected to my PC through code (C++) ?
Yes, using SetupDi* functions.
Thanking you
Regards
Devang Vyas
Hello,

In Win2000 when I call "SetupDiRemoveDevice" it removes bluetooth
device from "Device Manager".
But it still works fine ( I have installed third party bluetooth
driver for Win2000).
And GUID_DEVCLASS_BLUETOOTH in "SetupDiGetClassDevs" doesn't works in
win2000.
So how can I find out installed bluetooth device in PC.

Thanx
Ben Voigt [C++ MVP]
2008-04-07 13:37:07 UTC
Permalink
Post by Devang
Post by Ben Voigt [C++ MVP]
Hi
I want todisablebluetoothdevice connected to my PC.
Can I disblebluetoothradio connected to my PC through code (C++) ?
Yes, using SetupDi* functions.
Thanking you
Regards
Devang Vyas
Hello,
In Win2000 when I call "SetupDiRemoveDevice" it removes bluetooth
device from "Device Manager".
But it still works fine ( I have installed third party bluetooth
driver for Win2000).
And GUID_DEVCLASS_BLUETOOTH in "SetupDiGetClassDevs" doesn't works in
win2000.
If you remove the driver, the device will be left unattached, and Windows
will install the best driver for it at the next opportunity.

If you want to disable, as you first said, try something along these lines
(this is C++/CLI code, but the steps should be readily apparent, mostly you
want to replace the error handling):

void Device::Disable( void )

{

SP_PROPCHANGE_PARAMS params;

params.ClassInstallHeader.cbSize = sizeof (SP_CLASSINSTALL_HEADER);

params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;

params.Scope = DICS_FLAG_GLOBAL;

params.HwProfile = 0;

params.StateChange = DICS_DISABLE;

if (!SetupDiSetClassInstallParamsW((HDEVINFO)deviceSet,
(PSP_DEVINFO_DATA)deviceData, &params.ClassInstallHeader, sizeof params))

throw gcnew WinapiException();

if (!SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, (HDEVINFO)deviceSet,
(PSP_DEVINFO_DATA)deviceData))

throw gcnew WinapiException();

}
Post by Devang
So how can I find out installed bluetooth device in PC.
Thanx
Devang
2008-04-08 05:35:48 UTC
Permalink
Post by Ben Voigt [C++ MVP]
Post by Devang
Post by Ben Voigt [C++ MVP]
Hi
I want todisablebluetoothdevice connected to my PC.
Can I disblebluetoothradio connected to my PC through code (C++) ?
Yes, using SetupDi* functions.
Thanking you
Regards
Devang Vyas
Hello,
In Win2000 when I call "SetupDiRemoveDevice" it removes bluetooth
device from "Device Manager".
But it still works fine ( I have installed third party bluetooth
driver for Win2000).
And GUID_DEVCLASS_BLUETOOTH in "SetupDiGetClassDevs" doesn't works in
win2000.
If you remove the driver, the device will be left unattached, and Windows
will install the best driver for it at the next opportunity.
If you want to disable, as you first said, try something along these lines
(this is C++/CLI code, but the steps should be readily apparent, mostly you
void Device::Disable( void )
{
SP_PROPCHANGE_PARAMS params;
params.ClassInstallHeader.cbSize = sizeof (SP_CLASSINSTALL_HEADER);
params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
params.Scope = DICS_FLAG_GLOBAL;
params.HwProfile = 0;
params.StateChange = DICS_DISABLE;
if (!SetupDiSetClassInstallParamsW((HDEVINFO)deviceSet,
(PSP_DEVINFO_DATA)deviceData, &params.ClassInstallHeader, sizeof params))
throw gcnew WinapiException();
if (!SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, (HDEVINFO)deviceSet,
(PSP_DEVINFO_DATA)deviceData))
throw gcnew WinapiException();
}
Post by Devang
So how can I find out installed bluetooth device in PC.
Thanx
Ya Thanks

Your code sample was very helpful.
It too works fine for WinXP SP2.
But I am facing problem with "Windows 2000".
I have installed "BlueSoleil" driver on Windows 2000.
I am able to find out arrival of bluetooth device(In win2k using
device class desc).
But unable to disble it. The same code work fine for WinXP.
Ben Voigt [C++ MVP]
2008-04-08 14:29:30 UTC
Permalink
Post by Devang
Post by Ben Voigt [C++ MVP]
Post by Devang
Post by Ben Voigt [C++ MVP]
Hi
I want todisablebluetoothdevice connected to my PC.
Can I disblebluetoothradio connected to my PC through code (C++) ?
Yes, using SetupDi* functions.
Thanking you
Regards
Devang Vyas
Hello,
In Win2000 when I call "SetupDiRemoveDevice" it removes bluetooth
device from "Device Manager".
But it still works fine ( I have installed third party bluetooth
driver for Win2000).
And GUID_DEVCLASS_BLUETOOTH in "SetupDiGetClassDevs" doesn't works
in win2000.
If you remove the driver, the device will be left unattached, and
Windows will install the best driver for it at the next opportunity.
If you want to disable, as you first said, try something along these
lines (this is C++/CLI code, but the steps should be readily
void Device::Disable( void )
{
SP_PROPCHANGE_PARAMS params;
params.ClassInstallHeader.cbSize = sizeof (SP_CLASSINSTALL_HEADER);
params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
params.Scope = DICS_FLAG_GLOBAL;
params.HwProfile = 0;
params.StateChange = DICS_DISABLE;
if (!SetupDiSetClassInstallParamsW((HDEVINFO)deviceSet,
(PSP_DEVINFO_DATA)deviceData, &params.ClassInstallHeader, sizeof params))
throw gcnew WinapiException();
if (!SetupDiCallClassInstaller(DIF_PROPERTYCHANGE,
(HDEVINFO)deviceSet, (PSP_DEVINFO_DATA)deviceData))
throw gcnew WinapiException();
}
Post by Devang
So how can I find out installed bluetooth device in PC.
Thanx
Ya Thanks
Your code sample was very helpful.
It too works fine for WinXP SP2.
But I am facing problem with "Windows 2000".
I have installed "BlueSoleil" driver on Windows 2000.
I am able to find out arrival of bluetooth device(In win2k using
device class desc).
But unable to disble it. The same code work fine for WinXP.
Are any of the API calls failing? What does GetLastError() return?
Devang
2008-04-09 05:03:33 UTC
Permalink
Post by Ben Voigt [C++ MVP]
Post by Devang
Post by Ben Voigt [C++ MVP]
Post by Devang
Post by Ben Voigt [C++ MVP]
Hi
I want todisablebluetoothdevice connected to my PC.
Can I disblebluetoothradio connected to my PC through code (C++) ?
Yes, using SetupDi* functions.
Thanking you
Regards
Devang Vyas
Hello,
In Win2000 when I call "SetupDiRemoveDevice" it removes bluetooth
device from "Device Manager".
But it still works fine ( I have installed third party bluetooth
driver for Win2000).
And GUID_DEVCLASS_BLUETOOTH in "SetupDiGetClassDevs" doesn't works
in win2000.
If you remove the driver, the device will be left unattached, and
Windows will install the best driver for it at the next opportunity.
If you want to disable, as you first said, try something along these
lines (this is C++/CLI code, but the steps should be readily
void Device::Disable( void )
{
SP_PROPCHANGE_PARAMS params;
params.ClassInstallHeader.cbSize = sizeof (SP_CLASSINSTALL_HEADER);
params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
params.Scope = DICS_FLAG_GLOBAL;
params.HwProfile = 0;
params.StateChange = DICS_DISABLE;
if (!SetupDiSetClassInstallParamsW((HDEVINFO)deviceSet,
(PSP_DEVINFO_DATA)deviceData, &params.ClassInstallHeader, sizeof params))
throw gcnew WinapiException();
if (!SetupDiCallClassInstaller(DIF_PROPERTYCHANGE,
(HDEVINFO)deviceSet, (PSP_DEVINFO_DATA)deviceData))
throw gcnew WinapiException();
}
Post by Devang
So how can I find out installed bluetooth device in PC.
Thanx
Ya Thanks
Your code sample was very helpful.
It too works fine for WinXP SP2.
But I am facing problem with "Windows 2000".
I have installed "BlueSoleil" driver on Windows 2000.
I am able to find out arrival of bluetooth device(In win2k using
device class desc).
But unable to disble it. The same code work fine for WinXP.
Are any of the API calls failing? What does GetLastError() return?
Actually when I use API "SetupDiRemoveDevice", it removes device from
device manager
But device is still usable, and can be used from "Bluesoleil" GUI.
and following sequence of APIs you suggested
-SetupDiSetClassInstallParamsW
-SetupDiCallClassInstaller
Returns no error but doesn't make any effect.

Thanks
Ben Voigt [C++ MVP]
2008-04-09 14:08:10 UTC
Permalink
Post by Devang
Post by Ben Voigt [C++ MVP]
Post by Devang
Post by Ben Voigt [C++ MVP]
Post by Devang
Post by Ben Voigt [C++ MVP]
Hi
I want todisablebluetoothdevice connected to my PC.
Can I disblebluetoothradio connected to my PC through code (C++) ?
Yes, using SetupDi* functions.
Thanking you
Regards
Devang Vyas
Hello,
In Win2000 when I call "SetupDiRemoveDevice" it removes bluetooth
device from "Device Manager".
But it still works fine ( I have installed third party bluetooth
driver for Win2000).
And GUID_DEVCLASS_BLUETOOTH in "SetupDiGetClassDevs" doesn't works
in win2000.
If you remove the driver, the device will be left unattached, and
Windows will install the best driver for it at the next
opportunity.
If you want to disable, as you first said, try something along
these lines (this is C++/CLI code, but the steps should be readily
void Device::Disable( void )
{
SP_PROPCHANGE_PARAMS params;
params.ClassInstallHeader.cbSize = sizeof (SP_CLASSINSTALL_HEADER);
params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
params.Scope = DICS_FLAG_GLOBAL;
params.HwProfile = 0;
params.StateChange = DICS_DISABLE;
if (!SetupDiSetClassInstallParamsW((HDEVINFO)deviceSet,
(PSP_DEVINFO_DATA)deviceData, &params.ClassInstallHeader, sizeof params))
throw gcnew WinapiException();
if (!SetupDiCallClassInstaller(DIF_PROPERTYCHANGE,
(HDEVINFO)deviceSet, (PSP_DEVINFO_DATA)deviceData))
throw gcnew WinapiException();
}
Post by Devang
So how can I find out installed bluetooth device in PC.
Thanx
Ya Thanks
Your code sample was very helpful.
It too works fine for WinXP SP2.
But I am facing problem with "Windows 2000".
I have installed "BlueSoleil" driver on Windows 2000.
I am able to find out arrival of bluetooth device(In win2k using
device class desc).
But unable to disble it. The same code work fine for WinXP.
Are any of the API calls failing? What does GetLastError() return?
Actually when I use API "SetupDiRemoveDevice", it removes device from
device manager
But device is still usable, and can be used from "Bluesoleil" GUI.
Is this different from what happens if you uninstall from device manager?
Post by Devang
and following sequence of APIs you suggested
-SetupDiSetClassInstallParamsW
-SetupDiCallClassInstaller
Returns no error but doesn't make any effect.
That should have disabled the device, so that device manager would show a
red X over the icon.
Post by Devang
Thanks
nidhi misra
2010-08-07 04:01:02 UTC
Permalink
hi..
I have tried to use ur code given in this post,but der are sum error as sum variables not defined or void Device not found...
Plz hepl me in this matter..
Thanks..
:)



Devang wrote:

Re: Want help regarding : "disable bluetooth device"
11-Apr-08

On Apr 8, 7:29 pm, "Ben Voigt [C++ MVP]" <***@nospam.nospam> wrote

Actually when I use API "SetupDiRemoveDevice", it removes device fro
device manage
But device is still usable, and can be used from "Bluesoleil" GUI
and following sequence of APIs you suggeste
-SetupDiSetClassInstallParams
-SetupDiCallClassInstalle
Returns no error but doesn't make any effect

Thanks

Previous Posts In This Thread:

On Monday, March 31, 2008 6:33 PM
Ben Voigt [C++ MVP] wrote:

Re: Want help regarding : "disable bluetooth device"
Devang wrote

Yes, using SetupDi* functions.

On Thursday, April 03, 2008 2:10 AM
Devang wrote:

Want help regarding : "disable bluetooth device"
H

I want to disable bluetooth device connected to my PC
Can I disble bluetooth radio connected to my PC through code (C++)

Thanking yo

Regard
Devang Vyas

On Thursday, April 03, 2008 2:10 AM
Devang wrote:

Re: Want help regarding : "disable bluetooth device"
Thank you very much for your valuable help

On Monday, April 07, 2008 9:37 AM
Ben Voigt [C++ MVP] wrote:

Re: Want help regarding : "disable bluetooth device"
Devang wrote

If you remove the driver, the device will be left unattached, and Windows
will install the best driver for it at the next opportunity

If you want to disable, as you first said, try something along these lines
(this is C++/CLI code, but the steps should be readily apparent, mostly you
want to replace the error handling)

void Device::Disable( void



SP_PROPCHANGE_PARAMS params

params.ClassInstallHeader.cbSize = sizeof (SP_CLASSINSTALL_HEADER)

params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE

params.Scope = DICS_FLAG_GLOBAL

params.HwProfile = 0

params.StateChange = DICS_DISABLE

if (!SetupDiSetClassInstallParamsW((HDEVINFO)deviceSet,
(PSP_DEVINFO_DATA)deviceData, &params.ClassInstallHeader, sizeof params)

throw gcnew WinapiException()

if (!SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, (HDEVINFO)deviceSet,
(PSP_DEVINFO_DATA)deviceData)

throw gcnew WinapiException()

}

On Tuesday, April 08, 2008 10:29 AM
Ben Voigt [C++ MVP] wrote:

Re: Want help regarding : "disable bluetooth device"
Devang wrote

Are any of the API calls failing? What does GetLastError() return?

On Tuesday, April 08, 2008 10:03 PM
Devang wrote:

Re: Want help regarding : "disable bluetooth device"
On Apr 1, 3:33 am, "Ben Voigt [C++ MVP]" <***@nospam.nospam> wrote

Hello

In Win2000 when I call "SetupDiRemoveDevice" it removes bluetoot
device from "Device Manager"
But it still works fine ( I have installed third party bluetoot
driver for Win2000)
And GUID_DEVCLASS_BLUETOOTH in "SetupDiGetClassDevs" doesn't works i
win2000
So how can I find out installed bluetooth device in PC

Thanx

On Tuesday, April 08, 2008 10:04 PM
Devang wrote:

Re: Want help regarding : "disable bluetooth device"
On Apr 7, 6:37 pm, "Ben Voigt [C++ MVP]" <***@nospam.nospam> wrote

Ya Thank

Your code sample was very helpful
It too works fine for WinXP SP2
But I am facing problem with "Windows 2000"
I have installed "BlueSoleil" driver on Windows 2000
I am able to find out arrival of bluetooth device(In win2k usin
device class desc)
But unable to disble it. The same code work fine for WinXP.

On Wednesday, April 09, 2008 10:08 AM
Ben Voigt [C++ MVP] wrote:

Re: Want help regarding : "disable bluetooth device"
Devang wrote

Is this different from what happens if you uninstall from device manager

That should have disabled the device, so that device manager would show
red X over the icon.

On Friday, April 11, 2008 4:25 AM
Devang wrote:

Re: Want help regarding : "disable bluetooth device"
On Apr 8, 7:29 pm, "Ben Voigt [C++ MVP]" <***@nospam.nospam> wrote

Actually when I use API "SetupDiRemoveDevice", it removes device fro
device manager
But device is still usable, and can be used from "Bluesoleil" GUI.
and following sequence of APIs you suggested
-SetupDiSetClassInstallParamsW
-SetupDiCallClassInstaller
Returns no error but doesn't make any effect.

Thanks


Submitted via EggHeadCafe - Software Developer Portal of Choice
AJAX Web Service Driven Customers Table With Customer Details
http://www.eggheadcafe.com/tutorials/aspnet/4c3d2726-d99e-4f83-9e49-0d4867b6271a/ajax-web-service-driven-customers-table-with-customer-details.aspx
Devang Vyas
2010-08-07 04:12:26 UTC
Permalink
Its just a snap of a code.

You need to write code for get notification or enumerate through bluetooth device. and other part will block/remove that device.



nidhi misra wrote:

Want HELP regarding,disabling Bluetooth device Programmically.
07-Aug-10

hi..
I have tried to use ur code given in this post,but der are sum error as sum variables not defined or void Device not found...
Plz hepl me in this matter..
Thanks..
:)

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
Custom Favorites Web Site with MongoDb and NoRM
http://www.eggheadcafe.com/tutorials/aspnet/7fbc7a01-5d30-4cd3-b373-51d4a0e1afa8/custom-favorites-web-site-with-mongodb-and-norm.aspx
nidhi misra
2010-08-07 04:31:20 UTC
Permalink
hi.
I'm new in this field and have very little knowledge
if u can plz help in writing code for above mentioned
methods
will be Gratefull to u..
Thanks
:)



Devang Vyas wrote:

block bluetooth
07-Aug-10

Its just a snap of a code.

You need to write code for get notification or enumerate through bluetooth device. and other part will block/remove that device.

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
Excel Identifying which formulas are slowing down workbook recalaculation
http://www.eggheadcafe.com/tutorials/aspnet/917072d4-8194-4f18-8455-75b2ebe359f0/excel-identifying-which-formulas-are-slowing-down-workbook-recalaculation.aspx
nidhi misra
2010-08-09 05:04:43 UTC
Permalink
hi..
Can Any1 tell me where do I have to define parameter of the following Function-


!SetupDiSetClassInstallParams(HDEVINFO)deviceSet

Thanks
Nidhi



nidhi misra wrote:

BlueTooth Code To Disable..
07-Aug-10

hi.
I'm new in this field and have very little knowledge
if u can plz help in writing code for above mentioned
methods
will be Gratefull to u..
Thanks
:)

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
Scrolling in WPF Toolkit?s Column Chart
http://www.eggheadcafe.com/tutorials/aspnet/0939d60c-8e17-4a27-b898-1fc772d2d6f6/scrolling-in-wpf-toolkits-column-chart.aspx
nidhi misra
2010-08-11 04:40:27 UTC
Permalink
hi..
Im able to disable bluetooth but it want system to reboot.Cn any1 tell me how cn I disable bluetooth without restaring/rebooting.
Thanks
NIdhi

Submitted via EggHeadCafe - Software Developer Portal of Choice
Make The WebClient Class follow redirects and get Target Url
http://www.eggheadcafe.com/tutorials/aspnet/70511872-c3aa-4e92-a7d7-dd4b09881af5/make-the-webclient-class-follow-redirects-and-get-target-url.aspx
nidhi misra
2010-08-18 04:19:08 UTC
Permalink
hi everyone
I want to disable bluetooth without restarting the system
Im able to to disable the bluetooth bt it want system to restart.
So know Im using BluetoothSetServiceState() to disable the bluetooth,but it is not working.
Does anyone of u have used it before,or using it
then plz help me..
thanks in advance.
Nidhi
:)


Submitted via EggHeadCafe - Software Developer Portal of Choice
A Comparison of Managed Compression Algorithms
http://www.eggheadcafe.com/tutorials/aspnet/71485ecc-2d2d-435a-9c35-3d12b279f9ae/a-comparison-of-managed-compression-algorithms.aspx
Loading...