AnnGetHyperlinkType example for Delphi
var
//Global declarations
RasterAnn: LEADRasterAnnotation;
RasterAnnToolbar: LEADRasterAnnToolBar;
procedure TForm1.Button1Click(Sender: TObject);
begin
RasterAnn:= CoLEADRasterAnnotation.Create ();
RasterAnnToolbar:= CoLEADRasterAnnToolBar.Create ();
RasterAnn.AnnParentRasterView := LEADRasterView1.Raster;
LEADEventSink1.Connect (RasterAnn, _LEADRasterAnnotationEvents);
RasterAnn.AnnUserMode:= ANN_USERMODE_DESIGN;
end;
//This examples determines the type of the hyperlink and then displays the
//params if the type is ANN_LINK_ANNEVENT or ANN_LINK_ANNEVENT5
procedure TForm1. LEADEventSink1Invoke(Sender: TObject; DispID: Integer;
const IID: TGUID; LocaleID: Integer; Flags: Word; Params: tagDISPPARAMS;
varResult, ExcepInfo, ArgErr: Pointer);
var
msgStr: String;
nType: Smallint;
hObject: Integer;
iParamCount: Integer;
lParam1: Longint;
lParam2: Longint;
lParam3: Longint;
lParam4: Longint;
lParam5: Longint;
begin
case (DispID) of
LEADRASTERANNOTATIONEVENTS_ANNHYPERLINK:
begin
lParam5:= OleVariant(Params.rgvarg^[0]);
lParam4:= OleVariant(Params.rgvarg^[1]);
lParam3:= OleVariant(Params.rgvarg^[2]);
lParam2:= OleVariant(Params.rgvarg^[3]);
lParam1:= OleVariant(Params.rgvarg^[4]);
iParamCount:= OleVariant(Params.rgvarg^[5]);
hObject:= OleVariant(Params.rgvarg^[6]);
RasterAnn.AnnGetHyperlinkType (hObject);
nType:= RasterAnn.AnnHyperlinkType;
if ((nType = ANN_LINK_ANNEVENT5) Or (nType = ANN_LINK_ANNEVENT)) then
begin
if iParamCount >= 0 then
msgStr:= IntToStr(iParamCount) + ' params are valid' + Chr(13);
if iParamCount >= 1 then
msgStr := msgStr + 'Param1: ' + IntToStr(lParam1) + Chr(13);
if iParamCount >= 2 then
msgStr := msgStr + 'Param2: ' + IntToStr(lParam2) + Chr(13);
if iParamCount >= 3 then
msgStr := msgStr + 'Param3: ' + IntToStr(lParam3) + Chr(13);
if iParamCount >= 4 then
msgStr := msgStr + 'Param4: ' + IntToStr(lParam4) + Chr(13);
if iParamCount = 5 then
msgStr := msgStr + 'Param5: ' + IntToStr(lParam5) + Chr(13);
end
else
msgStr := 'Invalid Type';
ShowMessage (msgStr);
end;
end;
end;