Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6160055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:14:09+00:00 2026-05-23T21:14:09+00:00

Using DSPack, Delphi XE I need to take a snapshot from a webcam and

  • 0

Using DSPack, Delphi XE I need to take a snapshot from a webcam and allow a preview before which the user is allowed to save to JPEG file. How can this be done (code)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T21:14:09+00:00Added an answer on May 23, 2026 at 9:14 pm

    Maybe this will work, but I have not tested it. You should give it a try.

    unit main;
    
    interface
    
    uses
     Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
     Dialogs, StdCtrls, DSPack, DSUtil, DirectShow9;
    
    type
     TMainForm = class(TForm)
       CaptureGraph: TFilterGraph;
       VideoWindow: TVideoWindow;
       ListBox1: TListBox;
       VideoSourceFilter: TFilter;
       StartButton: TButton;
       StopButton: TButton;
       Label1: TLabel;
       ListBox2: TListBox;
       Label3: TLabel;
       procedure FormCreate(Sender: TObject);
       procedure FormDestroy(Sender: TObject);
       procedure ListBox1Click(Sender: TObject);
       procedure StartButtonClick(Sender: TObject);
       procedure StopButtonClick(Sender: TObject);
     private
       { Private declarations }
     public
       { Public declarations }
     end;
    
    var
     MainForm: TMainForm;
     VideoDevice: TSysDevEnum;
     VideoMediaTypes: TEnumMediaType;
    implementation
    
    {$R *.dfm}
    
    { TMainForm }
    
    procedure TMainForm.FormCreate(Sender: TObject);
    var i: integer;
    begin
     VideoDevice := TSysDevEnum.Create(CLSID_VideoInputDeviceCategory);
     for i := 0 to VideoDevice.CountFilters - 1 do
       ListBox1.Items.Add(VideoDevice.Filters[i].FriendlyName);
    
     VideoMediaTypes := TEnumMediaType.Create;
    end;
    
    procedure TMainForm.FormDestroy(Sender: TObject);
    begin
     VideoDevice.Free;
     VideoMediaTypes.Free;
    end;
    
    // Selecting of the video source
    procedure TMainForm.ListBox1Click(Sender: TObject);
    var
     PinList: TPinList;
     i: integer;
    begin
     VideoDevice.SelectGUIDCategory(CLSID_VideoInputDeviceCategory);
     if ListBox1.ItemIndex <> -1 then
     begin
       // Set the device which we work with
       VideoSourceFilter.BaseFilter.Moniker := VideoDevice.GetMoniker(ListBox1.ItemIndex);
       VideoSourceFilter.FilterGraph := CaptureGraph;
       CaptureGraph.Active := true;
       PinList := TPinList.Create(VideoSourceFilter as IBaseFilter);
       ListBox2.Clear;
       VideoMediaTypes.Assign(PinList.First);
       // Adding permission to ListBox2, which supports device
       for i := 0 to VideoMediaTypes.Count - 1 do
         ListBox2.Items.Add(VideoMediaTypes.MediaDescription[i]);
       CaptureGraph.Active := false;
       PinList.Free;
       StartButton.Enabled := true;
     end;
    end;
    
    procedure TMainForm.StartButtonClick(Sender: TObject);
    var
     PinList: TPinList;
    begin
    
     // Activating graph filter, at this stage the source filter is added to the graph
     CaptureGraph.Active := true;
    
     // The configuration of the output device
     if VideoSourceFilter.FilterGraph <> nil then
     begin
       PinList := TPinList.Create(VideoSourceFilter as IBaseFilter);
       if ListBox2.ItemIndex <> -1 then
         with (PinList.First as IAMStreamConfig) do
           SetFormat(VideoMediaTypes.Items[ListBox2.ItemIndex].AMMediaType^);
       PinList.Free;
     end;
    
     // now render streams
     with CaptureGraph as IcaptureGraphBuilder2 do
     begin
       // Hooking up a preview video (VideoWindow)
       if VideoSourceFilter.BaseFilter.DataLength > 0 then
         RenderStream(@PIN_CATEGORY_PREVIEW, nil, VideoSourceFilter as IBaseFilter,
           nil , VideoWindow as IBaseFilter);
    
     end;
    // Launch video
     CaptureGraph.Play;
     StopButton.Enabled := true;
     StartButton.Enabled := false;
     ListBox2.Enabled := false;
     ListBox1.Enabled := false;
    end;
    
    // Stop video
    procedure TMainForm.StopButtonClick(Sender: TObject);
    begin
     StopButton.Enabled := false;
     StartButton.Enabled := true;
     CaptureGraph.Stop;
     CaptureGraph.Active := False;
     ListBox2.Enabled := true;
     ListBox1.Enabled := true;
    end;
    
    end.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the Facebook PHP SDK, what steps do I need to take to allow
Using C#, I need a class called User that has a username, password, active
Using the below XML, I need to figure out which person worked more hours
Using PHP I'm attempting to take an HTML string passed from a WYSIWYG editor
Using the http://www.ifans.com/forums/showthread.php?t=132024 post from another question i am allowing the user to enter
Using an access token with offline_access (which I believe is the ultimate and most
I am using a 3rd-party rotator object, which is providing a smooth, random rotation
I am attempting to pull some information from my tnsnames file using regex. I
Using VB6 & Crystal Report 9. Need help with the VB6 code. When i
Using VB or C#, I am getting a string of variable length from the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.