Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to reference to special types in Type Library?

12 views
Skip to first unread message

Ma Xiaoming

unread,
May 11, 2008, 4:14:57 AM5/11/08
to
Dear ladies and gentlemen,

I have been trying to convert a standard Delphi component to an ActiveX
component. Thus, I need to add some properties and methods in Type Library.
For the standerd data type, that will be easy, but if we need to reference a
special data type in Type Lirary, that would be a problem, such as:

type
PDirEntry = ^TDEntry;
TDEntry = record
ShortName: String;
LongName: String;
Imported: Boolean;
Size, SizeJ: Int64;
Path: String;
Address,
AddressJ: Integer;
Depth: Byte;
Number: Integer;
Parent: PDirEntry;
Files: PFileEntry;
Order: Integer;
end;

How to add properies of type PDirEntry/TDEntry respectively in Type
Library? For example, I need to add a property A which type of PDirEntry and
property B which type of TDEntry in Type Library, how can I do?

property A: PDirEntry;
property B: TDEntry;

And how to reference the following data type in Type Library?

~~~~~~~~~~~~~~~~~~~~~~~~~~~
type

TSearchRec = record // record type, ?
Time: Integer;
Size: Integer;
Attr: Integer;
Name: TFileName;
ExcludeAttr: Integer;
FindHandle: THandle;
FindData: TWin32FindData;

PFileEntry = ^TFEntry; // Ponter to a record type, ?
TFEntry = record
ShortName: String;
LongName: String;
Path: String;
Imported: Boolean;
Time: TDateTime;
FileSize, FileSizeJ: Int64;
SpaceReqOnDisc: Int64;
Address: Integer;
AddressJ: Integer;
Attr: Integer;
ResetArchiveBit: Boolean;
DirRec: PDirEntry; // Type of PDirEntry, ?
Next: PFileEntry; // Type of PFileEntry, ?
Prev: Boolean;
Buffer: PChar;
end;

TDisc = record // recode type again, ?
Valid: Boolean;
TotalBlocks: Cardinal;
UsedBlocks: Cardinal;
BlockLength: Cardinal;
FirstCompleteSession,
LastCompleteSession,
DiscStatus,
LastSession : Byte;
DiscTypeCode: Word;
DiscType: String;
Eraseable: Boolean;
end;

TScsiDeviceCapabilities = ( dcReadCDR,
dcReadCDRW,
dcReadMethod2,
dcReadDVD,
dcReadDVDR,
dcReadDVDRW,
dcReadDVDRAM,
dcReadDVDPLUSR,
dcReadDVDPLUSRW,
dcWriteCDR,
dcWriteCDRW,
dcWriteTest,
dcWriteDVDR,
dcWriteDVDRW,
dcWriteDVDRAM,
dcWriteDVDPLUSR,
dcWriteDVDPLUSRW,
dcWriteISRC,
dcUnderrunProtection ); // Enumeration, that
easy!
TDeviceCapabilities = set of TScsiDeviceCapabilities; // Set of type, ?

TInquiryData = packed record // Packed record with many arrays, ?
PeripheralData: Byte;
RMB: Byte;
Version: Byte;
Byte3: Byte;
AdditionalLen: Byte;
Byte5: Byte;
Byte6: Byte;
Byte7: Byte;
VendorID: array[8..15] of char;
ProductID: array[16..31] of char;
ProductRev: array[32..35] of char;
VendorSpecific: array[36..55] of char;
Byte56: Byte;
Reseverd: Byte;
v1, v2, v3, v4: Word;
OtherVData: array [0..62] of byte;
DeviceType: ShortInt; //PeripheralData
Qulifier: Byte;
end;

And there are three standard types are both the problem:

type
A: Pointer;
B: TWinControl;
C: THandle;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note, the symbol ? means that I don't know how to do it.

Oh my god, there are too many questions from me. Help me, please. Thank
you very much.

Best regards.

Xiaoming


Remy Lebeau (TeamB)

unread,
May 12, 2008, 1:06:29 PM5/12/08
to

"Ma Xiaoming" <maxiaom...@hotmail.com> wrote in message
news:4826...@newsgroups.borland.com...

> I have been trying to convert a standard Delphi component to an
> ActiveX component. Thus, I need to add some properties and methods
> in Type Library. For the standerd data type, that will be easy, but if
> we need to reference a special data type in Type Lirary, that would
> be a problem, such as:

You have to expose your data using a separate interface that has its own
properties and methods. Internally, it can access your raw record data as
needed.

> How to add properies of type PDirEntry/TDEntry respectively in Type
> Library?

You don't. You will have to expose the individual fields separately in a
COM-friendly manner.

> And how to reference the following data type in Type Library?

You can't. Again, you have to wrap the data using your own COM-safe
interfaces instead.


Gambit


Ma Xiaoguang

unread,
May 12, 2008, 8:50:49 PM5/12/08
to
Hi Remy,

Many thanks for your help.

Best regards.

Xiaoming


0 new messages