Topic: Undeclared identifier and type error using Dmitry code snippet
I attempted to use this code suggested by Dmitry - http://myvisualdatabase.com/forum/viewt … 702#p31702 to determine if Outlook is installed on a users PC.
This fails on two points when compiling.
1. The type TCLSID is not recognised.
2. The function CLSIDFromProgID causes an error 'Undeclared identifier'.
Has this type and function not been included in MVD 6.4, or is there an alternative call?
The code I've written.
function CheckAppInStalled(AValue: String): boolean;
var
FCLSID: TCLSID;
begin
Result := (CLSIDFromProgID(PChar(AValue), FCLSID) = S_OK);
end;
procedure Form1_Button2_OnClick (Sender: TObject; var Cancel: boolean);
const
olMailItem = 0;
var
Outlook: Variant;
vMailItem: variant;
begin
if CheckAppInstalled('Outlook.Application') then
begin
Outlook := CreateOleObject('Outlook.Application');
vMailItem := Outlook.GetNamespace('MAPI');
vMailItem.Logon;
vMailItem := Outlook.CreateItem(olMailItem);
vMailItem.Recipients.Add('dibbledabble@somewhere.someplace');
vMailItem.Subject := 'What a wonderful test email';
vMailItem.Body := 'This is a test --> how amazing';
vMailItem.Send;
Outlook := nil;
end
else begin // open non outlook installed client
openFile('mailto:?Subject=PURCHASE ORDER PO: 123 &Body= no outlook installed')
end;
end;