<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[My Visual Database — Undeclared identifier and type error using Dmitry code snippet]]></title>
		<link>https://myvisualdatabase.com/forum/viewtopic.php?id=7109</link>
		<atom:link href="https://myvisualdatabase.com/forum/extern.php?action=feed&amp;tid=7109&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Undeclared identifier and type error using Dmitry code snippet.]]></description>
		<lastBuildDate>Sat, 14 Nov 2020 04:08:26 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Undeclared identifier and type error using Dmitry code snippet]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=38846#p38846</link>
			<description><![CDATA[<p>A possible but unsatisfactory workaround is to use a try.... except wrap-around.</p><div class="codebox"><pre><code>try
      Outlook := CreateOleObject(&#039;Outlook.Application&#039;);



    vMailItem := Outlook.GetNamespace(&#039;MAPI&#039;);

    vMailItem.Logon;
    vMailItem := Outlook.CreateItem(olMailItem);
    vMailItem.Recipients.Add(&#039;dibbledabble@somewhere.someplace&#039;);
    vMailItem.Subject := &#039;What a wonderful test email&#039;;
    vMailItem.Body := &#039;This is a test --&gt; how amazing&#039;;
    vMailItem.Send;
    Outlook := nil;
    except
     openFile(&#039;mailto:?Subject=PURCHASE ORDER PO: 123 &amp;Body= no outlook installed&#039;)
 end;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (CDB)]]></author>
			<pubDate>Sat, 14 Nov 2020 04:08:26 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=38846#p38846</guid>
		</item>
		<item>
			<title><![CDATA[Undeclared identifier and type error using Dmitry code snippet]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=38845#p38845</link>
			<description><![CDATA[<p>I attempted to use this code suggested by Dmitry -&nbsp; <a href="http://myvisualdatabase.com/forum/viewtopic.php?pid=31702#p31702">http://myvisualdatabase.com/forum/viewt … 702#p31702</a>&nbsp; to determine if Outlook is installed on a users PC.</p><br /><p>This fails on two points when compiling.</p><br /><p>1.&nbsp; The type TCLSID&nbsp; is not recognised.</p><br /><p>2. The function CLSIDFromProgID&nbsp; causes an error &#039;Undeclared identifier&#039;.</p><br /><p>Has this type and function not been included in MVD 6.4, or is there an alternative call?</p><br /><br /><p>The code I&#039;ve written.</p><br /><div class="codebox"><pre><code>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(&#039;Outlook.Application&#039;) then
   begin
      Outlook := CreateOleObject(&#039;Outlook.Application&#039;);
   
      vMailItem := Outlook.GetNamespace(&#039;MAPI&#039;);
      vMailItem.Logon;
      vMailItem := Outlook.CreateItem(olMailItem);
      vMailItem.Recipients.Add(&#039;dibbledabble@somewhere.someplace&#039;);
      vMailItem.Subject := &#039;What a wonderful test email&#039;;
      vMailItem.Body := &#039;This is a test --&gt; how amazing&#039;;
      vMailItem.Send;
      Outlook := nil;
  end
  else begin  // open non outlook installed client
     openFile(&#039;mailto:?Subject=PURCHASE ORDER PO: 123 &amp;Body= no outlook installed&#039;)
  end;
end;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (CDB)]]></author>
			<pubDate>Sat, 14 Nov 2020 03:22:47 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=38845#p38845</guid>
		</item>
	</channel>
</rss>
