Delphi interface notes

xiaoxiao2021-03-06  60

// A: = StringToguid ('{000208FB-0000-0000-C000-000000000046}'); // iChart and Chart interface each have different GUIDs Attores // A: = StringToguid ('{000208fb-0001- 0000-C000-000000000046} ');} // StringToguid is used to convert a string Guid to tguid // guidtoTString to convert Tguid to string guid // varsupports to determine whether Variant variables support Tguid this interface

procedure TForm1.btnGenerateClick (Sender: TObject); var Guid: TGUID; begin CoCreateGuid (Guid); Memo1.Lines.Add (GuidToString (Guid)); end; Supports function to determine whether to support a particular interface; this procedure can generate a GUID the CoCreateGuid No. . GuidToString converts Tguid into string GuidStringToguid converts string guid to tguid type

Tguid Declaration Tguid = Packed Record D1: Longword; D2: Word; D3: Word; D4: Array [0..7] of byte; end; guid example: {D2552D95-A2D7-48D8-AA27-F08E810779BD}

Automatically release it when the interface variable is assigned NIL. A process or function that implements a variable that implements an interface is directly assigned to a parameter as a parameter as a parameter.

Declaration of an interface array: fempArray: array [1 .. max_employees] of iunknown;

The automation object in the OLE container is in communication with the xxxx_tlb.pas after IMPORT. Var vSHT: IUNKNOWN; ISHT: _WORKBOOK; begin ilc.run; if not (olc.state = osrunning) Then olc.run; vSHT: = OLC.OLEOBJECTINTERFACE; // Call OleObjectInterface instead of OLEOBJECT ISHT: = VSHT AS _WORKBOOK; ESHT.CONNECTTTO (ISHT); (Esht.worksheets.Item [1] as _Worksheet) .Cells.Item [1,1] .value: = 25; esht.Application.quit; esht.disconnect;

Question: Why is the interface between Iapplication, iChart ..., etc., if the Delphi Import Office's Graph object is generated? In addition, the interface in the graph can find the same GUID in the registry, and the interface is not found. Why? In addition, according to the FLAG, it seems to be stated as a meaning of Hidden Dispable? Hide interface? What is the use? debugging? Why is EXCEL's IMPORT?

The interface is really a mess: Each object has its own mode for each object of XXXX_TLB.PAS for each COM component? Not the same? what happened? do not understand!

转载请注明原文地址:https://www.9cbs.com/read-119490.html

New Post(0)