Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
media
danimation.controls
danimation.programming
devices
drm
dshow.programming
dtransform
encoder
encoder.optimization
hometheaterpc
media
media.beta
media.beta.encoder
mediacenter
mediacenter.portable
mediaplayer
music.products
musicproducer
player
player.plugins
player.skins
player.solaris
player.visualizations
player.web
sdk
server
tools
  
 
date: Sat, 17 May 2008 09:25:36 +0200,    group: microsoft.public.windowsmedia.sdk        back       


Receiving notification of new capture device plugged in   
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
date: Sat, 17 May 2008 09:25:36 +0200   author:   Paul Kirkaas

Re: Receiving notification of new capture device plugged in   
On May 17, 9:25 am, 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

You could try manually checking it every few seconds, or you can catch
Firewire and USB system events.

Jerislav
date: Wed, 21 May 2008 08:09:38 -0700 (PDT)   author:   Jere cro

Re: Receiving notification of new capture device plugged in   
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: Wed, 21 May 2008 08:22:34 -0700   author:   sasha

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

Re: Receiving notification of new capture device plugged in   
Paul Kirkaas wrote:
> for WM_DEVICECHANGE to OnDeviceChange, and it works like a charm. Thanks 
> again!
> 


No problem!
date: Tue, 27 May 2008 17:32:23 -0700   author:   sasha

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us