Hallo allemaal,

Op de valreep in 2009.

Ik heb een DVR-camera systeem met een webinterface.
Het webinterface maakt gebruik van een ActiveX (OCX) applet.

Ik heb het OCX bestand geimporteerd in delphi.
Nu kan ik connecten met de DVR-server.
Ook kan ik opvragen wat de status van de camera's is.
Maar hoe kan ik nou de beelden tonen?

Hieronder de import van het OCX bestand:

Code:
unit WebDiginetLib_TLB;

// ************************************************************************ //
// WARNING                                                                    
// -------                                                                    
// The types declared in this file were generated from data read from a       
// Type Library. If this type library is explicitly or indirectly (via        
// another type library referring to this type library) re-imported, or the   
// 'Refresh' command of the Type Library Editor activated while editing the   
// Type Library, the contents of this file will be regenerated and all        
// manual modifications will be lost.                                         
// ************************************************************************ //

// $Rev: 5081 $
// File generated on 31-12-2009 11:55:48 from Type Library described below.

// ************************************************************************  //
// Type Lib: C:\Windows\system32\webdiginet.ocx (1)
// LIBID: {D24BE4EF-B65B-4E9B-98AC-EED897799B5B}
// LCID: 0
// Helpfile: C:\Windows\system32\WebDiginet.hlp
// HelpString: WebDiginet ActiveX Control module
// DepndLst: 
//   (1) v2.0 stdole, (C:\Windows\system32\stdole2.tlb)
// ************************************************************************ //
// *************************************************************************//
// NOTE:                                                                      
// Items guarded by $IFDEF_LIVE_SERVER_AT_DESIGN_TIME are used by properties  
// which return objects that may need to be explicitly created via a function 
// call prior to any access via the property. These items have been disabled  
// in order to prevent accidental use from within the object inspector. You   
// may enable them by defining LIVE_SERVER_AT_DESIGN_TIME or by selectively   
// removing them from the $IFDEF blocks. However, such items must still be    
// programmatically created via a method of the appropriate CoClass before    
// they can be used.                                                          
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. 
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
interface

uses Windows, ActiveX, Classes, Graphics, OleCtrls, OleServer, StdVCL, Variants;
  


// *********************************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:        
//   Type Libraries     : LIBID_xxxx                                      
//   CoClasses          : CLASS_xxxx                                      
//   DISPInterfaces     : DIID_xxxx                                       
//   Non-DISP interfaces: IID_xxxx                                        
// *********************************************************************//
const
  // TypeLibrary Major and minor versions
  WebDiginetLibMajorVersion = 1;
  WebDiginetLibMinorVersion = 0;

  LIBID_WebDiginetLib: TGUID = '{D24BE4EF-B65B-4E9B-98AC-EED897799B5B}';

  DIID__DWebDiginet: TGUID = '{DEB5159F-BEA8-44DD-8187-C72848EAC6EF}';
  DIID__DWebDiginetEvents: TGUID = '{D23D9D90-8626-46B6-87BF-AD663E304D3A}';
  CLASS_WebDiginet: TGUID = '{9E265649-6E0E-4EEA-9F49-DAE0801440CF}';
type

// *********************************************************************//
// Forward declaration of types defined in TypeLibrary                    
// *********************************************************************//
  _DWebDiginet = dispinterface;
  _DWebDiginetEvents = dispinterface;

// *********************************************************************//
// Declaration of CoClasses defined in Type Library                       
// (NOTE: Here we map each CoClass to its Default Interface)              
// *********************************************************************//
  WebDiginet = _DWebDiginet;


// *********************************************************************//
// DispIntf:  _DWebDiginet
// Flags:     (4112) Hidden Dispatchable
// GUID:      {DEB5159F-BEA8-44DD-8187-C72848EAC6EF}
// *********************************************************************//
  _DWebDiginet = dispinterface
    ['{DEB5159F-BEA8-44DD-8187-C72848EAC6EF}']
    procedure WDPTZRight; dispid 6;
    function WDConnect(const ip: WideString; const password: WideString; 
                       const sitecode: WideString; vdoport: Smallint; ctlport: Smallint): WordBool; dispid 1;
    function WDPlayStop: WordBool; dispid 2;
    function WDDisconnect: WordBool; dispid 13;
    procedure WDPTZDown; dispid 4;
    procedure WDPTZLeft; dispid 5;
    procedure WDPTZUp; dispid 3;
    procedure WDZoomIn; dispid 7;
    procedure WDZoomOut; dispid 8;
    procedure WDFocusIn; dispid 9;
    procedure WDFocusOut; dispid 10;
    function WDClose: WordBool; dispid 11;
    function WDCreate: WordBool; dispid 12;
    procedure WDCamera(Num: Smallint); dispid 14;
    function WDGetStatus: WideString; dispid 15;
    procedure WDInitcamera; dispid 16;
    function WDDivide(mode: Smallint): WordBool; dispid 17;
    function WDCameraStatus(Num: Smallint): WordBool; dispid 18;
    procedure WDChangeMode(mode: Smallint); dispid 19;
    procedure WDDisplayOSD(nType: Smallint; bShow: WordBool); dispid 20;
    procedure WDAnonymous(bAnonymous: WordBool); dispid 21;
    procedure WDSearch(Command: Smallint); dispid 22;
    procedure WDSetSearchTime(Year: Smallint; Month: Smallint; Day: Smallint; Hour: Smallint; 
                              Minute: Smallint); dispid 23;
    function WDGetSearchTime: TDateTime; dispid 24;
    function WDSearchCamera(nCam: Smallint; bSelect: WordBool): WordBool; dispid 25;
    procedure AboutBox; dispid -552;
    property BackColor: OLE_COLOR dispid -501;
  end;

// *********************************************************************//
// DispIntf:  _DWebDiginetEvents
// Flags:     (4096) Dispatchable
// GUID:      {D23D9D90-8626-46B6-87BF-AD663E304D3A}
// *********************************************************************//
  _DWebDiginetEvents = dispinterface
    ['{D23D9D90-8626-46B6-87BF-AD663E304D3A}']
    procedure WDUpdateSearchTime(Date: TDateTime); dispid 1;
  end;


// *********************************************************************//
// OLE Control Proxy class declaration
// Control Name     : TWebDiginet
// Help String      : WebDiginet Control
// Default Interface: _DWebDiginet
// Def. Intf. DISP? : Yes
// Event   Interface: _DWebDiginetEvents
// TypeFlags        : (34) CanCreate Control
// *********************************************************************//
  TWebDiginetWDUpdateSearchTime = procedure(ASender: TObject; Date: TDateTime) of object;

  TWebDiginet = class(TOleControl)
  private
    FOnWDUpdateSearchTime: TWebDiginetWDUpdateSearchTime;
    FIntf: _DWebDiginet;
    function  GetControlInterface: _DWebDiginet;
  protected
    procedure CreateControl;
    procedure InitControlData; override;
  public
    procedure WDPTZRight;
    function WDConnect(const ip: WideString; const password: WideString; 
                       const sitecode: WideString; vdoport: Smallint; ctlport: Smallint): WordBool;
    function WDPlayStop: WordBool;
    function WDDisconnect: WordBool;
    procedure WDPTZDown;
    procedure WDPTZLeft;
    procedure WDPTZUp;
    procedure WDZoomIn;
    procedure WDZoomOut;
    procedure WDFocusIn;
    procedure WDFocusOut;
    function WDClose: WordBool;
    function WDCreate: WordBool;
    procedure WDCamera(Num: Smallint);
    function WDGetStatus: WideString;
    procedure WDInitcamera;
    function WDDivide(mode: Smallint): WordBool;
    function WDCameraStatus(Num: Smallint): WordBool;
    procedure WDChangeMode(mode: Smallint);
    procedure WDDisplayOSD(nType: Smallint; bShow: WordBool);
    procedure WDAnonymous(bAnonymous: WordBool);
    procedure WDSearch(Command: Smallint);
    procedure WDSetSearchTime(Year: Smallint; Month: Smallint; Day: Smallint; Hour: Smallint; 
                              Minute: Smallint);
    function WDGetSearchTime: TDateTime;
    function WDSearchCamera(nCam: Smallint; bSelect: WordBool): WordBool;
    procedure AboutBox;
    property  ControlInterface: _DWebDiginet read GetControlInterface;
    property  DefaultInterface: _DWebDiginet read GetControlInterface;
  published
    property Anchors;
    property  ParentColor;
    property  TabStop;
    property  Align;
    property  DragCursor;
    property  DragMode;
    property  ParentShowHint;
    property  PopupMenu;
    property  ShowHint;
    property  TabOrder;
    property  Visible;
    property  OnDragDrop;
    property  OnDragOver;
    property  OnEndDrag;
    property  OnEnter;
    property  OnExit;
    property  OnStartDrag;
    property BackColor: TColor index -501 read GetTColorProp write SetTColorProp stored False;
    property OnWDUpdateSearchTime: TWebDiginetWDUpdateSearchTime read FOnWDUpdateSearchTime write FOnWDUpdateSearchTime;
  end;

procedure Register;

resourcestring
  dtlServerPage = 'ActiveX';

  dtlOcxPage = 'ActiveX';

implementation

uses ComObj;

procedure TWebDiginet.InitControlData;
const
  CEventDispIDs: array [0..0] of DWORD = (
    $00000001);
  CControlData: TControlData2 = (
    ClassID: '{9E265649-6E0E-4EEA-9F49-DAE0801440CF}';
    EventIID: '{D23D9D90-8626-46B6-87BF-AD663E304D3A}';
    EventCount: 1;
    EventDispIDs: @CEventDispIDs;
    LicenseKey: nil (*HR:$80004005*);
    Flags: $00000001;
    Version: 401);
begin
  ControlData := @CControlData;
  TControlData2(CControlData).FirstEventOfs := Cardinal(@@FOnWDUpdateSearchTime) - Cardinal(Self);
end;

procedure TWebDiginet.CreateControl;

  procedure DoCreate;
  begin
    FIntf := IUnknown(OleObject) as _DWebDiginet;
  end;

begin
  if FIntf = nil then DoCreate;
end;

function TWebDiginet.GetControlInterface: _DWebDiginet;
begin
  CreateControl;
  Result := FIntf;
end;

procedure TWebDiginet.WDPTZRight;
begin
  DefaultInterface.WDPTZRight;
end;

function TWebDiginet.WDConnect(const ip: WideString; const password: WideString; 
                               const sitecode: WideString; vdoport: Smallint; ctlport: Smallint): WordBool;
begin
  Result := DefaultInterface.WDConnect(ip, password, sitecode, vdoport, ctlport);
end;

function TWebDiginet.WDPlayStop: WordBool;
begin
  Result := DefaultInterface.WDPlayStop;
end;

function TWebDiginet.WDDisconnect: WordBool;
begin
  Result := DefaultInterface.WDDisconnect;
end;

procedure TWebDiginet.WDPTZDown;
begin
  DefaultInterface.WDPTZDown;
end;

procedure TWebDiginet.WDPTZLeft;
begin
  DefaultInterface.WDPTZLeft;
end;

procedure TWebDiginet.WDPTZUp;
begin
  DefaultInterface.WDPTZUp;
end;

procedure TWebDiginet.WDZoomIn;
begin
  DefaultInterface.WDZoomIn;
end;

procedure TWebDiginet.WDZoomOut;
begin
  DefaultInterface.WDZoomOut;
end;

procedure TWebDiginet.WDFocusIn;
begin
  DefaultInterface.WDFocusIn;
end;

procedure TWebDiginet.WDFocusOut;
begin
  DefaultInterface.WDFocusOut;
end;

function TWebDiginet.WDClose: WordBool;
begin
  Result := DefaultInterface.WDClose;
end;

function TWebDiginet.WDCreate: WordBool;
begin
  Result := DefaultInterface.WDCreate;
end;

procedure TWebDiginet.WDCamera(Num: Smallint);
begin
  DefaultInterface.WDCamera(Num);
end;

function TWebDiginet.WDGetStatus: WideString;
begin
  Result := DefaultInterface.WDGetStatus;
end;

procedure TWebDiginet.WDInitcamera;
begin
  DefaultInterface.WDInitcamera;
end;

function TWebDiginet.WDDivide(mode: Smallint): WordBool;
begin
  Result := DefaultInterface.WDDivide(mode);
end;

function TWebDiginet.WDCameraStatus(Num: Smallint): WordBool;
begin
  Result := DefaultInterface.WDCameraStatus(Num);
end;

procedure TWebDiginet.WDChangeMode(mode: Smallint);
begin
  DefaultInterface.WDChangeMode(mode);
end;

procedure TWebDiginet.WDDisplayOSD(nType: Smallint; bShow: WordBool);
begin
  DefaultInterface.WDDisplayOSD(nType, bShow);
end;

procedure TWebDiginet.WDAnonymous(bAnonymous: WordBool);
begin
  DefaultInterface.WDAnonymous(bAnonymous);
end;

procedure TWebDiginet.WDSearch(Command: Smallint);
begin
  DefaultInterface.WDSearch(Command);
end;

procedure TWebDiginet.WDSetSearchTime(Year: Smallint; Month: Smallint; Day: Smallint; 
                                      Hour: Smallint; Minute: Smallint);
begin
  DefaultInterface.WDSetSearchTime(Year, Month, Day, Hour, Minute);
end;

function TWebDiginet.WDGetSearchTime: TDateTime;
begin
  Result := DefaultInterface.WDGetSearchTime;
end;

function TWebDiginet.WDSearchCamera(nCam: Smallint; bSelect: WordBool): WordBool;
begin
  Result := DefaultInterface.WDSearchCamera(nCam, bSelect);
end;

procedure TWebDiginet.AboutBox;
begin
  DefaultInterface.AboutBox;
end;

procedure Register;
begin
  RegisterComponents(dtlOcxPage, [TWebDiginet]);
end;

end.
Met deze code kan ik verbinden:

Code:
procedure TForm10.FormCreate(Sender: TObject);
begin
  A := TWebDiginet.Create(Self);
  A.Align := alClient;
  A.WDChangeMode(1);

  if A.WDCreate then
  begin
    if A.WDConnect(IP, PASSWD, SC, 8079, 8081) then
    begin
      with A do
      begin
        WDPlayStop;
        WDCamera(1);
        WDInitcamera;
        WDDivide(1);
      end;
    end;
  end;
end;
Heeft iemand een idee hoe ik de beelden kan opvragen?

Gr.
Danido.