Solved

OLE Application Server : Interfacing Excel XP RTD Functions

Posted on 2001-08-21
2
1,543 Views
Last Modified: 2007-12-19
Hi
To know what I'm talking about goto:

http://msdn.microsoft.com/library/en-us/dnexcl2k2/html/odc_xlrtdbuild.asp
http://msdn.microsoft.com/library/en-us/dnexcl2k2/html/odc_xlrtdfaq.asp

I'm wondering where to start from.....
I've developped what I needed but when it comes to write the Type Library
I'm lost !!!!
The program gets compiled correctly, I register it correctly but then I can't use it because the Type Library is missing.
The most complicated problem is converting Types, since the IRtdServer Interface uses some types that seem to be non COM compatible, witch is NOT possible since this interface was built to be used only via COM.
The VB 6 example by Microsoft works correctly, but I need to use Delphi.

Here's some sample code:
-------------------------------
unit RtdTestAutoObj;

interface

uses
  ComObj, ActiveX, pG2RtdTest2_TLB, StdVcl, Excel_TLB, uCommonData;

Const SUCCESS = 1;

type
  TG2RtdTest2 = class(TAutoObject, IRtdServer, IG2RtdTest2)
  protected
    { Protected declarations }
    function  ServerStart(const CallbackObject: IRTDUpdateEvent): Integer;
safecall;
    function  ConnectData(TopicID: Integer; var Strings: PSafeArray; var
GetNewValues: WordBool): OleVariant; safecall;
    function  RefreshData(var TopicCount: Integer): PSafeArray; safecall;
    procedure DisconnectData(TopicID: Integer); safecall;
    function  Heartbeat: Integer; safecall;
    procedure ServerTerminate; safecall;
  end;

implementation

uses ComServ;

{ TG2RtdTest2 }

function TG2RtdTest2.ConnectData(TopicID: Integer; var Strings: PSafeArray;
var GetNewValues: WordBool): OleVariant;
Var
 i : Integer;
    pov : POleVariant;
    pc  : PChar;
begin
 i := High(RtData) + 1;
    SetLength(RtData, i+1);
    RtData[i].TCount := TopicID;

    pc := PChar(Strings.pvData);
    RtData[i].Titolo := String(pc);

    RtData[i].valore := '';
    RtData[i].NewData := False;
    Result := 'Connection OK';
end;

procedure TG2RtdTest2.DisconnectData(TopicID: Integer);
Var
 i : Integer;
begin
 For i := 0 to high(Rtdata) Do Begin
     If RtData[i].TCount = TopicID Then Begin
   RtData[i].TCount := 0;
            RtData[i].Titolo := '';
        end;
    End;
end;

function TG2RtdTest2.Heartbeat: Integer;
begin
 Result := SUCCESS;
end;

function TG2RtdTest2.RefreshData(var TopicCount: Integer): PSafeArray;
Var
 P : Pointer;
    Pov : Variant;
    i,x  : Integer;
begin
 x := 0 ;
 For i := 0 to High(RtData) Do Begin
     IF RtData[i].NewData Then Inc(x);
    End;

    If x > 0 Then Begin
     x := 0;
  Pov := VarArrayCreate([2,x], varVariant);
  For i := 0 to High(RtData) Do Begin
      IF RtData[i].TCount = TopicCount Then Begin
          Pov[0,x] := Variant(RtData[i].TCount);
             Pov[1,x] := Variant(RtData[i].valore);
                Inc(x);
         end;
     End;
        P := VarArrayLock(Pov);
        TopicCount := x;
        Result := PSafeArray(P);
        VarArrayUnlock(Pov);
    End Else
     TopicCount := 0;
end;

function TG2RtdTest2.ServerStart(const CallbackObject: IRTDUpdateEvent):
Integer;
begin
 CbObj := CallbackObject;
    result := SUCCESS;
end;

procedure TG2RtdTest2.ServerTerminate;
begin

end;

initialization
  TAutoObjectFactory.Create(ComServer, TG2RtdTest2, Class_G2RtdTest2,
    ciSingleInstance, tmApartment);
end.
-------------------------------

Please Help

please reply to my Email adress as well

By
Marco


0
Comment
Question by:mgesiot
2 Comments
 
LVL 2

Accepted Solution

by:
hhamster earned 200 total points
ID: 6409191
At what point do you hang-up with TLBs?
Do you need a TLB for the above code?

Have you tried the Delphi's Type Lybrary Editor?
What version of Delphi are you using?
0
 

Author Comment

by:mgesiot
ID: 6409771
1) I haven't started the TLB since I don't know how to
convert the required types

2) I Do think so (look at Microsoft links for details)

3) YES, I used it but the problems are still the Types

4) Delphi 5.0 Ent (with all the upgrades)

Thanks for the interest
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
indy Tmemory stream non latin charcter issue 2 109
Delphi application Soap connection 5 102
Magic Software info 18 130
Multiple image collision 13 74
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now