|
|
|
date: Sat, 17 May 2008 09:25:36 +0200,
group: microsoft.public.windowsmedia.sdk
back
Re: Receiving notification of new capture device plugged in
Hi, Sasha:
Thanks; that pointed me in the right direction. For my purposes, it
turned out to be even simpler than that -- I just created a message map
for WM_DEVICECHANGE to OnDeviceChange, and it works like a charm.
Thanks again!
Paul
sasha wrote:
> Paul Kirkaas wrote:
>> In WME SDK, with VC++: I want to refresh my capture device list if my
>> custom app is up and running, and someone plugs in a new DV
>> camera/capture device. Any ideas how to do that?
>>
>> Thanks,
>>
>> Paul
>
>
> Here is some code that should help:
>
> DEV_BROADCAST_DEVICEINTERFACE filter;
> memset( &filter, 0, sizeof( filter ) );
>
> filter.dbcc_size = sizeof( filter );
> filter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
> filter.dbcc_classguid = KSCATEGORY_AUDIO; // or KSCATEGORY_VIDEO
>
> _hDevNotify = RegisterDeviceNotification( _hWindow, &filter,
> DEVICE_NOTIFY_WINDOW_HANDLE );
>
>
> ...
> in a window proc somewhere:
> switch ( message ) {
> case WM_DEVICECHANGE:
> if ( wParam == DBT_DEVICEREMOVEPENDING ) {
> // do whatever
> break;
> }
> if ( wParam == DBT_DEVICEARRIVAL || wParam ==
> DBT_DEVICEREMOVECOMPLETE ) {
>
> const PDEV_BROADCAST_HDR pDev = PDEV_BROADCAST_HDR(
> lParam );
> if ( pDev != NULL ) {
>
>
> if ( pDev->dbch_devicetype ==
> DBT_DEVTYP_DEVICEINTERFACE ) {
>
> const PDEV_BROADCAST_DEVICEINTERFACE pInter =
> (PDEV_BROADCAST_DEVICEINTERFACE)pDev;
> // do whatever
> }
> }
date: Tue, 27 May 2008 17:05:27 +0200
author: Paul Kirkaas
|
|