PropSettings.pas
上传用户:hylc_2004
上传日期:2014-01-23
资源大小:46800k
文件大小:3k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1.     (*********************************************************************
  2.      *                                                                   *
  3.      * The contents of this file are used with permission, subject to    *
  4.      * the Mozilla Public License Version 1.1 (the "License"); you may   *
  5.      * not use this file except in compliance with the License. You may  *
  6.      * obtain a copy of the License at                                   *
  7.      * http://www.mozilla.org/MPL/MPL-1.1.html                           *
  8.      *                                                                   *
  9.      * Software distributed under the License is distributed on an       *
  10.      * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or    *
  11.      * implied. See the License for the specific language governing      *
  12.      * rights and limitations under the License.                         *
  13.      *                                                                   *
  14.      * (C) 2004 Milenko Mitrovic <dcoder@dsp-worx.de>                    *
  15.      *                                                                   *
  16.      *********************************************************************)
  17. unit PropSettings;
  18. interface
  19. uses
  20.   SysUtils, Windows, Messages, Classes, Graphics, Controls, StdCtrls,
  21.   ExtCtrls, Forms, BaseClass, ComObj, StdVcl, AxCtrls, DirectShow9, Dialogs,
  22.   ShellAPI, DSoundDevices, ActiveX;
  23. const
  24.   CLSID_PropPageSettings : TGUID = '{7115E09B-F38B-4FE7-97FD-B99B2BF99B35}';
  25. type
  26.   TfrmSettings = class(TFormPropertyPage)
  27.     cmbDevices: TComboBox;
  28.     Label1: TLabel;
  29.     procedure FormCreate(Sender: TObject);
  30.     procedure cmbDevicesChange(Sender: TObject);
  31.   public
  32.     function OnConnect(Unknown: IUnknown): HRESULT; override;
  33.     function OnDisconnect: HRESULT; override;
  34.   end;
  35. implementation
  36. {$R *.DFM}
  37. function TfrmSettings.OnConnect(Unknown: IUnKnown): HRESULT;
  38. begin
  39.   result := NOERROR;
  40. end;
  41. function TfrmSettings.OnDisconnect: HRESULT;
  42. begin
  43.   result := NOERROR;
  44. end;
  45. procedure TfrmSettings.FormCreate(Sender: TObject);
  46. var
  47.   i : integer;
  48.   Guid : TGuid;
  49. begin
  50.   cmbDevices.Clear;
  51.   if DSDeviceList.Count < 1 then Exit;
  52.   for i := 0 to DSDeviceList.Count -1 do
  53.   begin
  54.     cmbDevices.Items.Add(DSDeviceList.Items[i].DeviceName);
  55.   end;
  56.   Guid := GetSavedDevice;
  57.   if IsEqualGUID(GUID_NULL,Guid) then
  58.   begin
  59.     cmbDevices.ItemIndex := 0;
  60.   end else
  61.   begin
  62.     for i := 0 to DSDeviceList.Count -1 do
  63.     begin
  64.       if IsEqualGUID(DSDeviceList.Items[i].DeviceGUID,Guid) then
  65.       begin
  66.         cmbDevices.ItemIndex := i;
  67.         break;
  68.       end;
  69.     end;
  70.   end;
  71. end;
  72. procedure TfrmSettings.cmbDevicesChange(Sender: TObject);
  73. begin
  74.   SaveDevice(DSDeviceList.Items[cmbDevices.ItemIndex].DeviceGUID);
  75. end;
  76. initialization
  77.   TBCClassFactory.CreatePropertyPage(TfrmSettings, CLSID_PropPageSettings);
  78. end.