Matej's homepage

This page was, is, and will always be under construction. You have been warned :)

I have been working with Delphi since version 1.0. Here are some projects I have worked on:

And back in Delphi 1.0 times:


OLE document server

OLE doucment sever: This projects consist of two parts:

  • TRichEditWithOle: extended TRichEdit, which can contain OLE objects
  • TDelphiOLE: OLE document server
  • Project is in eraly beta 0.92. TRichEditWithOle works fine, but TDelphiOle needs some more polishing. You can download entire project (source code is included) or just take a look at the latest readme file.


    TRichEditWithOle

    Rich edit with OLE objects

    Delphi does not support inserting of OLE objects (bitmaps, metafiles, sounds, etc.) in rich edit control Therefore, I have created TRichEditWithOle component. TRichEditWithOle has following methods and properties:

    procedure InsertObject(theObject:TMyOle;pos:integer)
    Inserts OLE object derived from TMyOle
    procedure InsertObject2(theObject:IOleObject;pos:integer;storage:ISto rage)
    Inserts any OLE objects. TheObject points to object's interface.
    property richEditOle:IRichEditOle (read only)
    Returns IRichEditOle interface of TRichEditWithOle component
    property objectCount:longint (read only)
    Returns number of OLE objects, that TRichEditWithOle contains.
    property objects[i:integer]:IOleObject (read only)
    Array, that can be used to access OLE objects contained in TRichEditWithOle. Don't forget to call Release when you don't need retreived object anymore.
    property delphiObjects[i:integer]:TDelphiOle (read only)
    Similar to objects property, but only objects derived from TDelphiOle are returned. If delphiObject[i] is not derived from TDelphiObject, nil is returned.
    event OnQueryInsertObject(Sender:TObject;const clsid:TCLSID;cp:Longin t;var canInsert:boolean)
    Fired whenever OLE objects is about to be inserted. Set canInsert to false to prevent insertion. Also fired when object. that is going to be inserted is derived from TDelphiOle and OnQueryInsertDelphiObject is not assigned.
    event OnQueryInsertDelphiObject(Sender:TObject;classRef:TDelphiOleCla ss;cp:Longint;var canInsert:boolean)
    Fired whenever OLE objects derived from TDelphiOle is about to be inserted. Set canInsert to false to prevent insertion.
    event OnGetOleDragFromSource(sender:TObject;source:TObject;var oleObject:TDelphiOle)
    Fired whenever a drag and drop operation is started from Delphi (with BeginDrag, for example) and OLE objects is needed. If you provied a TDelphiObject in oleObject parameter, this object will be inserted in TRichEditWithOle. This event enables seamless integration of Delphi's and OLE's drag & drop operation.


    TDelphiOle

    Delphi has no built in support for OLE document servers (Do not confuse document servers whith automation servers! OLE automation servers can be easily created with Delphi 2.0 and can be accessed from other programming languges (Visual Basic, Excel etc.). Document servers are servers used to create specific type of documents. They are are displayed, when you choose Insert/object in (for example) Microsoft Word.

    That's why I have created TDelphiOle. You can now create OLE document server by simply creating new object, that inherits from TDelphiOle and implementing abstract methods. I am warning you: this objects is in early beta - it has been tested by number of people, but however lacks some functional ity (such as adding Insertable key to the registry). See readme.txt for details.

    class function GetCLSID:TCLSID; virtual; abstract;
    Returns CLSID of OLE object.
    class function GetUserType:string; virtual; abstract;
    Returns object's description.
    class function GetProgID:string; virtual; abstract;
    Returns object's programatic identifier.
    procedure Draw(dwDrawAspect: Longint;const bounds:TRect;Canvas:TCanva s); virtual; abstract;
    Draws the object on provided canvas.
    procedure Save(str:TStream); virtual; abstract;
    Saves object's state to the stream.
    procedure Load(str:TStream); virtual; abstract;
    Loads object's state from the stream.
    function GetExtent(dwDrawAspect: Longint):TPoint; virtual; abstract; // result in HIMETRIC
    Returns object's extent.
    function DoVerb(iVerb: Longint): HResult; virtual; abstract;
    Exexutes some action.
    procedure Changed; virtual;
    Call this procedure whenever state of object has changed and object needs to be redrawed.
    procedure Release;
    Releases reference to the object. Call this procedure, when object is obtained through TRichEditWithOle.delphiObjects[] and you don't need the object anymore.
    property owner:TMyOle (read only)
    Contains reference to TMyOle object, which in fact implements all OLE interfaces (IOleObect,IDataObject, etc.)

    Following piece of code implements OLE objects that represent itself as blue circle:

    type 
      TOleCircle=class(TDelphiOle)
        public
          class function  GetCLSID:TCLSID; override;
          class function  GetUserType:string; override;
          class function  GetProgID:string; override;
          procedure   Draw(dwDrawAspect: Longint;const bounds:TRect;Canvas:TCanvas);
     override;
          procedure   Save(str:TStream); override;
          procedure   Load(str:TStream); override;
          function    DoVerb(iVerb: Longint): HResult; override;
          function    GetExtent(dwDrawAspect: Longint):TPoint; override; // result i
    n HIMETRIC
      end;
    implementation
    procedure TOleCircle.Draw(dwDrawAspect: Longint;const bounds:
    TRect;Canvas:TCanvas);
    begin
      canvas.pen.color:=clBlue;
      canvas.brush.color:=clBlue;
      canvas.brush.style:=bsFDiagonal;
      with bounds do canvas.ellipse(left,top,right,bottom);
    end;
    procedure TOleCircle.Save(str:TStream); // we don't have anything to save 
    begin end;
    procedure TOleCircle.Load(str:TStream);
    begin end;
    function  TOleCircle.DoVerb(iVerb: Longint): HResult;
    begin
      result:=S_OK; // we could displayed ad message box when object is double click
    ed
    end;
    function  TOleCircle.GetExtent(dwDrawAspect: Longint):TPoint;  // result in HIME
    TRIC
    begin
      result.x:=500; result.y:=500;
    end;
    class function TOleCircle.GetCLSID:TCLSID; // {7CA25701-0DFB-11CF-85B0-444553540
    000}
    const CIRCLE_CLSID:TGUID = (D1:$7CA25701;D2:$0DFB;D3:$11CF;D4:($85,$B0,$44,$45,$
    53,$54,$00,$00));
    begin result:=CIRCLE_CLSID; end;
    class function  TOleCircle.GetUserType:string; begin result:='OleDemo Circle exa
    mple'; end;
    class function  TOleCircle.GetProgID:string; begin result:='OleDemo.'+className;
     end;

    TTelefon TTelefon image

    TTelefon and TGlobalSetting components enable you to dial any telephone number you want from your Delphi applications. You can use three different dialing methods (pulse or tone dialing with modem, and dialing with sound card). TTelefon components, which actually does the work can share common settings with help of TGlobalSetting component.

    That's the first component I have created with Delphi. It is usefull only in Windows 3.1, because WIndows 95 has introduced new ways for dealing with telephony (TAPI). You can download TTelefon right here. Help file is included.


    Grid (Mrea)Mreza icon

    I wrote this program, because no other programs can draw a mathematical function on fine, 1 mm grid. You can plot mathematical functions, add multiple sets of points, draw regression lines and export picture to.WMF (windows meta file) format. Check out About dialog. You will like it :) Only slovene version is currentlz available. Click here to download.

    Snapshot


    Who am I:

    I am a student of Computer Science at the Faculty of Electrical & Computer Engeneering Ljubljana, Slovenija.

    Matej Trampu
    Glinka ulica 2/a
    SI -111 Ljubljana
    Slovenija
    Europe

    E-Mail:
    Matej.Trampus@kiss.muzej.si

    (Have u played Ultima?)
    Page created: 25.1.1997
    Page visists: 1962