GKoehn
Guest
|
I create a delphi object in the outlook custom form when the user pulls up a new email.
Object is created in adxOlFormADXBeforeFormShow event.
When the user sends the email I get notified in the OutlookAppEvents.ItemSend event.
The custom form is still showing when I get notified.
How can I reach into the custom form at that time and access the delphi object I created when the custom form was shown on a new email? |
|
Andrei Smolin
Add-in Express team
Posts: 18817
Joined: 2006-05-11
|
Hello Gregory,
I would suggest using TadxOlFormsCollectionItem.FormInstances[index] to enumerate form instances created by the specified TadxOlFormsCollectionItem.
function TAddInModule.FindCurrentForm(
Item: TadxOlFormsCollectionItem): TadxOlForm;
var
ActiveWindowHandle: HWND;
i: integer;
begin
result := nil;
ActiveWindowHandle := GetActiveWindow();
for i := 0 to Item.FormInstanceCount - 1 do begin
if (Item.FormInstances[i].Visible
and Item.FormInstances[i].Active) then begin
//An active form in an advanced form region has Visible = true , Active = true
//An inactive form in an advanced form region has Visible = true , Active = false
if ((ActiveWindowHandle = Item.FormInstances[i].Handle)
or (ActiveWindowHandle = Item.FormInstances[i].CurrentOutlookWindowHandle)) then begin
result := Item.FormInstances[i];
break;
end;
end;
end;
end;
Andrei Smolin
Add-in Express Team Leader |
|