Dismiss Notice

REGISTRATION IS AFTER ADMIN ACTIVATION

DONATIONS WITH PAYPAL CLICK TO BUTTON

1 MONTH VIP - 5$; 3 MONTHS VIP - 10$; 6 MONTHS VIP - 20$; 1 YEAR VIP - 30$; 2 YEARS VIP - 50$; GOLD USER FOR LIFE VIP - 150$

DONATIONS WITH Bitcoin Address:3NRs3CK3fhXifrNYxHEZKpETDd9vNLMsMD

Dismiss Notice
The registration is approved by the Administrator. It takes about 1 day to approve your registration
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 Administrator 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

Laws
Our website, law, laws, copyright and aims to be respectful of individual rights. Our site, as defined in the law of 5651 serves as a provider of space. According to the law, contrary to the law of site management has no obligation to monitor content. Therefore, our site has adopted the principle of fit and remove. Works are subject to copyright laws and is shared in a manner that violated their legal rights, or professional associations, rights holders who, adsdelphi@gmail.com I can reach us at e-mail address. Complaints considered to be infringing on the examination of the content will be removed from our site.
Donate Help To Us and Be VIP
DONATIONS WITH PAYPAL CLICK TO BUTTON
6 MONTHS VIP - 20$; 1 YEAR VIP - 30$; 2 YEARS VIP - 50$; GOLD USER FOR LIFE VIP - 150$
Social Block