1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

Enumerate all available webcam(s) to TComboBox

Discussion in 'Delphi Programming' started by mrmarman, Jan 9, 2014.

  1. mrmarman
    Offline

    mrmarman DF Member

    Hi.

    - This is migrated from DirectX9 package by me. There is no need to any external DirectX package. :)

    - I got only "FriendlyName"(s) for VLC Streaming needs in my project. You also enumerate "Description", "DevicePath", "CLSID".

    Procedure :
    Code:
    Uses ActiveX, ComObj;
      Type
        ICreateDevEnum = interface(IUnknown)
          ['{29840822-5B84-11D0-BD3B-00A0C911CE86}']
          (*** ICreateDevEnum methods ***)
          function CreateClassEnumerator(const clsidDeviceClass: TGUID;
              out ppEnumMoniker: IEnumMoniker; dwFlags: DWORD): HResult; stdcall;
      end;
    procedure EnumerateVideoInputDevices( Liste:TStrings );
    // Uses ActiveX, ComObj eklenecek
    const
      IID_ICreateDevEnum            : TGUID = '{29840822-5B84-11D0-BD3B-00A0C911CE86}';
      CLSID_SystemDeviceEnum        : TGUID = (D1:$62BE5D10;D2:$60EB;D3:$11D0;D4:($BD,$3B,$00,$A0,$C9,$11,$CE,$86));
      CLSID_VideoInputDeviceCategory: TGUID = (D1:$860BB310;D2:$5D01;D3:$11D0;D4:($BD,$3B,$00,$A0,$C9,$11,$CE,$86));
      IID_IPropertyBag              : TGUID = '{55272A00-42CB-11CE-8135-00AA004BB851}';
    var
      LDevEnum : ICreateDevEnum;
      ppEnumMoniker    : IEnumMoniker;
      pceltFetched : ULONG;
      Moniker    : IMoniker;
      PropBag    : IPropertyBag;
      pvar       : olevariant;
      hr         : HRESULT;
      strDescription, strFriendlyName, strDevicePath, strCLSID : String;
    begin
      CocreateInstance(CLSID_SystemDeviceEnum, nil, CLSCTX_INPROC, IID_ICreateDevEnum, LDevEnum);
      hr := LDevEnum.CreateClassEnumerator(CLSID_VideoInputDeviceCategory, ppEnumMoniker, 0);
      if (hr = S_OK) then
      begin
        while(ppEnumMoniker.Next(1, Moniker, @pceltFetched) = S_OK) do
          begin
            strDescription  := '';
            strFriendlyName := '';
            strDevicePath   := '';
            strCLSID        := '';
            Moniker.BindToStorage(nil, nil, IID_IPropertyBag, PropBag);
            if PropBag.Read('Description', pvar, nil) = S_OK then
              strDescription  := String(pvar);
            if PropBag.Read('FriendlyName', pvar, nil) = S_OK then
              strFriendlyName := String(pvar);
            if PropBag.Read('DevicePath', pvar, nil) = S_OK then
              strDevicePath   := (pvar);
            if PropBag.Read('CLSID', pvar, nil) = S_OK then
               strCLSID       := String(pvar);
            PropBag := nil;
            Moniker := nil;
            Liste.Add( strFriendlyName );
          end;
      end;
      ppEnumMoniker :=nil;
      LDevEnum :=nil;
    end;
    
    Usage :
    Code:
    procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
      EnumerateVideoInputDevices( ComboBox1.Items );
    end;
    
     
  2. AdminDF
    Online

    AdminDFAdminDF is a Verified Member Delphifan Staff Member DF Staff

    very good
    thank you man
     
  3. dodosoft
    Offline

    dodosoft DF Member

    Fine that run fine.
    After how can I take a picture from a webcam and save it in afile ?
    Thanks fot help
     

Share This Page