<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Developer mishmash</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/liviuc/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/liviuc/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 04:10:48 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>WPF TemplateBinding vs. RelativeSource TemplatedParent</title>
      <link>https://docs.microsoft.com/archive/blogs/liviuc/wpf-templatebinding-vs-relativesource-templatedparent</link>
      <pubDate>Mon, 14 Dec 2009 06:35:00 GMT</pubDate>
      <dc:creator><![CDATA[liviuc]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/liviuc/2009/12/14/wpf-templatebinding-vs-relativesource-templatedparent/</guid>
      <description><![CDATA[Trying to&nbsp;get the bindings right for&nbsp;a certain ControlTemplate&nbsp;I wanted to have for a...]]></description>
      <content:encoded><![CDATA[<P>Trying to&nbsp;get the bindings right for&nbsp;a certain ControlTemplate&nbsp;I wanted to have for a TabControl lead me to an interesting observation on TemplateBinding that was not so obvious.&nbsp;In the TabControl's ControlTemplate,&nbsp;I&nbsp;wanted to have&nbsp;an inner ItemsControl binding to the templated TabControl's Items (and thus replace the default TabPanels).</P>
<P>It ended up working with a <STRONG>RelativeSource</STRONG> binding like this:</P>
<BLOCKQUOTE>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&lt;</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ControlTemplate</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> x</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">:</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">Key</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">="CustomTabControlTemplate"</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> TargetType</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">="{</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">x</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">:</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">Type</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> TabControl</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">}"&gt;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...</SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&lt;</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ItemsControl</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: red"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN>Grid.Column</SPAN><SPAN style="COLOR: blue">="0"</SPAN><SPAN style="COLOR: red"> Grid.Row</SPAN><SPAN style="COLOR: blue">="0"</SPAN><SPAN style="COLOR: red"> Grid.ColumnSpan</SPAN><SPAN style="COLOR: blue">="2" &gt;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&lt;</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ItemsControl.ItemsSource</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&lt;</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">Binding</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> Mode</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">="OneWay"</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> Path</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">="Items"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=FR style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-ansi-language: FR">&lt;</SPAN><SPAN lang=FR style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-ansi-language: FR">Binding.RelativeSource</SPAN><SPAN lang=FR style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-ansi-language: FR">&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN lang=FR style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-ansi-language: FR"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=FR style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-ansi-language: FR">&lt;</SPAN><SPAN lang=FR style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-ansi-language: FR">RelativeSource<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN lang=FR style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-ansi-language: FR"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: red"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN>Mode</SPAN><SPAN style="COLOR: blue">="TemplatedParent"<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN lang=FR style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-ansi-language: FR"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&lt;/</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">Binding.RelativeSource</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&lt;/</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">Binding</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&lt;/</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ItemsControl.ItemsSource</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&lt;/</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ItemsControl</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P></BLOCKQUOTE>
<P mce_keep="true">I was intrigued that&nbsp;using the more usual&nbsp;TemplateBinding did <STRONG>not</STRONG> work (you get a compile time error):</P>
<BLOCKQUOTE>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&lt;</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ItemsControl</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: red"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN>ItemsSource</SPAN><SPAN style="COLOR: blue">="{</SPAN><SPAN style="COLOR: #a31515">TemplateBinding</SPAN><SPAN style="COLOR: red"> Items</SPAN><SPAN style="COLOR: blue">}"</SPAN><SPAN style="COLOR: red"> Grid.Column</SPAN><SPAN style="COLOR: blue">="0"</SPAN><SPAN style="COLOR: red"> Grid.Row</SPAN><SPAN style="COLOR: blue">="0"</SPAN><SPAN style="COLOR: red"> Grid.ColumnSpan</SPAN><SPAN style="COLOR: blue">="2" /&gt;<o:p></o:p></SPAN></SPAN></P></BLOCKQUOTE>
<P mce_keep="true">&nbsp;From the <A class="" href="https://msdn.microsoft.com/en-us/library/ms742882.aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/ms742882.aspx">TemplateBinding docs</A>, one can get the (wrong) impression that it should actually work. It says:</P>
<BLOCKQUOTE>
<P mce_keep="true">A <SPAN><SPAN class=input><STRONG>TemplateBinding</STRONG></SPAN></SPAN> is an optimized form of a <A id=ctl00_MainContent_ctl42_ctl00_ctl00 onclick="javascript:Track('ctl00_MainContent_ctl42_ctl00_contenthere|ctl00_MainContent_ctl42_ctl00_ctl00',this);" href="https://msdn.microsoft.com/en-us/library/ms750413.aspx"><FONT color=#2178e0>Binding</FONT></A> for template scenarios, analogous to a <SPAN><SPAN class=input><STRONG>Binding</STRONG></SPAN></SPAN> constructed with <SPAN class=code><FONT face="Courier New" color=#000066 size=4>{Binding&nbsp;RelativeSource={RelativeSource&nbsp;TemplatedParent} Mode=OneWay}</FONT></SPAN>.&nbsp;&nbsp;</P></BLOCKQUOTE>
<P mce_keep="true">The word "analogous" is misleading. At a search, it was clear that there are significant differences under the hood between <STRONG>Binding</STRONG> and <STRONG>TemplateBinding</STRONG>. Some of them are described <A class="" href="https://blogs.msdn.com/marlat/archive/2009/05/13/silverlight-3-template-binding-vs-relative-binding.aspx" target=_blank mce_href="https://blogs.msdn.com/marlat/archive/2009/05/13/silverlight-3-template-binding-vs-relative-binding.aspx">here</A>, however, none of them seemed to apply, which is why I tried to look again more carefully at the docs. And there's the explanation right on the&nbsp;TemplateBinding<A class="" href="https://msdn.microsoft.com/en-us/library/ms742882.aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/ms742882.aspx"> docs page</A>: unlike a Binding, a TemplateBinding can only&nbsp;bind a <STRONG>DependencyProperty</STRONG>&nbsp;to another <STRONG>DependencyPropery</STRONG>&nbsp;(IMHO, the&nbsp;wording of "targetProperty" in the docs below is confusing/wrong from a WPF binding terminology perspective, because the property on the type being templated is actually the source, the target being&nbsp;propertyName&nbsp;!):</P>
<P mce_keep="true">
<TABLE class="">
<TBODY>
<TR>
<TD class="">
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<P><SPAN class=parameter><EM>propertyName</EM></SPAN></P></BLOCKQUOTE></TD>
<TD class="">
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<P><SPAN></SPAN>&nbsp;</P>
<P><SPAN><A id=ctl00_MainContent_ctl41_ctl00_ctl00 onclick="javascript:Track('ctl00_MainContent_ctl41_ctl00_contenthere|ctl00_MainContent_ctl41_ctl00_ctl00',this);" href="https://msdn.microsoft.com/en-us/library/system.windows.dependencyproperty.name.aspx"><FONT color=#2178e0>DependencyProperty<SPAN class=cs>.</SPAN><SPAN class=vb>.</SPAN><SPAN class=cpp>::</SPAN><SPAN class=nu>.</SPAN>Name</FONT></A></SPAN> of the property being set in the setter syntax.</P>
<P mce_keep="true">&nbsp;</P></BLOCKQUOTE></TD></TR>
<TR>
<TD class="">
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<P><SPAN class=parameter><EM>targetProperty</EM></SPAN></P></BLOCKQUOTE></TD>
<TD class="">
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<P>A dependency property that exists on the type being templated, specified by its <SPAN><A id=ctl00_MainContent_ctl41_ctl00_ctl01 onclick="javascript:Track('ctl00_MainContent_ctl41_ctl00_contenthere|ctl00_MainContent_ctl41_ctl00_ctl01',this);" href="https://msdn.microsoft.com/en-us/library/system.windows.dependencyproperty.name.aspx"><FONT color=#2178e0>DependencyProperty<SPAN class=cs>.</SPAN><SPAN class=vb>.</SPAN><SPAN class=cpp>::</SPAN><SPAN class=nu>.</SPAN>Name</FONT></A></SPAN>.</P>
<P>- or -</P>
<P>A "dotted-down" property name that is defined by a different type than the target type being templated. This is actually a <SPAN><A id=ctl00_MainContent_ctl41_ctl00_ctl02 onclick="javascript:Track('ctl00_MainContent_ctl41_ctl00_contenthere|ctl00_MainContent_ctl41_ctl00_ctl02',this);" href="https://msdn.microsoft.com/en-us/library/system.windows.propertypath.aspx"><FONT color=#2178e0>PropertyPath</FONT></A></SPAN>. See <SPAN><A id=ctl00_MainContent_ctl41_ctl00_ctl03 onclick="javascript:Track('ctl00_MainContent_ctl41_ctl00_contenthere|ctl00_MainContent_ctl41_ctl00_ctl03',this);" href="https://msdn.microsoft.com/en-us/library/ms742451.aspx"><FONT color=#2178e0>PropertyPath XAML Syntax</FONT></A></SPAN>.</P></BLOCKQUOTE></TD></TR></TBODY></TABLE>&nbsp;</P>
<P mce_keep="true">But <STRONG>Items </STRONG>in an <A class="" href="https://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol_properties.aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol_properties.aspx">ItemsControl</A> is not a DependencyProperty (<STRONG>ItemsSource</STRONG> is !) which is why only a RelativeSource Binding works in this case.</P>
<BLOCKQUOTE>
<P mce_keep="true">&nbsp;</P></BLOCKQUOTE>]]></content:encoded>
    </item>
    <item>
      <title>.NET Interop and exception handling in mixed applications</title>
      <link>https://docs.microsoft.com/archive/blogs/liviuc/net-interop-and-exception-handling-in-mixed-applications</link>
      <pubDate>Tue, 13 Oct 2009 07:15:00 GMT</pubDate>
      <dc:creator><![CDATA[liviuc]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/liviuc/2009/10/13/net-interop-and-exception-handling-in-mixed-applications/</guid>
      <description><![CDATA[I thought it would be useful to write a blog post about .NET Interop&nbsp;and exception handling, as...]]></description>
      <content:encoded><![CDATA[<P>I thought it would be useful to write a blog post about .NET Interop&nbsp;and exception handling, as I have found that, although there is available information on this, it is spread on the net and not easy to be put together - so here we go.</P>
<P>With the advent of .NET, one of the key features that has enabled developer productivity is without doubt code-level <STRONG>interoperability</STRONG> between the native and managed world<STRONG>.</STRONG> This allows developers to bring a large variety of code components under the same application hood:</P>
<UL>
<LI>.NET assemblies</LI>
<LI>.NET Winforms controls</LI>
<LI>WPF components (via WPF/Winforms interoperability)</LI>
<LI>native Dlls</LI>
<LI>MFC</LI>
<LI>COM / ActiveX</LI>
<LI>and so on</LI></UL>
<P mce_keep="true">To accomplish interoperability at code level,&nbsp;several mechanisms to go from native to managed and the other way round are available:</P>
<UL>
<LI>
<DIV mce_keep="true"><STRONG><A class="" href="https://msdn.microsoft.com/en-us/library/aa288468(VS.71).aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/aa288468(VS.71).aspx">P/Invoke</A></STRONG>:&nbsp;allows direct calls from .NET into native Dlls via DllImports. Marshalling of data types can be controlled by DllImport attributes. A sort of a native-to -managed counterpart of this is the <A class="" href="https://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.getfunctionpointerfordelegate.aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.getfunctionpointerfordelegate.aspx">Marshal<SPAN class=cpp>::</SPAN>GetFunctionPointerForDelegate()</A>&nbsp;function in System.Runtime.InteropServices, which allows converting a managed delegate into a function pointer that can be called from unmanaged code. For example:</DIV></LI></UL>
<BLOCKQUOTE>
<BLOCKQUOTE>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><FONT face=Calibri><SPAN style="FONT-SIZE: 8pt; COLOR: blue; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes">namespace</SPAN><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"> ClassLibrary1<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>{<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">class</SPAN> <SPAN style="COLOR: #2b91af">Class1<o:p></o:p></SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>[<SPAN style="COLOR: #2b91af">DllImport</SPAN>(<SPAN style="COLOR: #a31515">"NativeDll.dll"</SPAN>, EntryPoint = <SPAN style="COLOR: #a31515">"#1"</SPAN>)]<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">extern</SPAN> <SPAN style="COLOR: #2b91af">UInt32</SPAN> MyFunction(<SPAN style="COLOR: #2b91af">UInt32</SPAN> a);<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><o:p><FONT face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">int</SPAN> Calculate(<SPAN style="COLOR: blue">int</SPAN> a, <SPAN style="COLOR: blue">int</SPAN> b)<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></FONT></SPAN><SPAN style="FONT-SIZE: 8pt; LINE-HEIGHT: 115%; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">int</SPAN> r = (<SPAN style="COLOR: blue">int</SPAN>)MyFunction(200);</FONT></SPAN></P></BLOCKQUOTE></BLOCKQUOTE>
<UL>
<LI>
<DIV mce_keep="true"><STRONG><A class="" href="https://msdn.microsoft.com/en-us/library/kew41ycz.aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/kew41ycz.aspx">COM Interop</A></STRONG>: allows bi-directional interop via COM. Marshalling to/from .NET is taken care of transparentty by the CLR using wrappers, so this can be expensive in terms of performance. </DIV></LI></UL>
<BLOCKQUOTE>
<BLOCKQUOTE>
<P mce_keep="true">Usually you would use <A class="" href="https://msdn.microsoft.com/en-us/library/aax7sdch.aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/aax7sdch.aspx">Interop Assemblies</A> (usually generated with <A class="" href="https://msdn.microsoft.com/en-us/library/tt0cf3sx(VS.80).aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/tt0cf3sx(VS.80).aspx">tlbimp</A> ) to call into COM from .NET. For the other way round, you can register a .NET assembly for COM Interop by using <A class="" href="https://msdn.microsoft.com/en-us/library/tzat5yw6(VS.80).aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/tzat5yw6(VS.80).aspx">regasm</A>&nbsp;or use the integrated Visual Studio support (<A class="" href="https://msdn.microsoft.com/en-us/library/w29wacsy(VS.80).aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/w29wacsy(VS.80).aspx">Register for COM interop</A>).</P></BLOCKQUOTE></BLOCKQUOTE>
<UL>
<LI>
<DIV mce_keep="true"><STRONG><A class="" href="https://msdn.microsoft.com/en-us/magazine/cc163567.aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/magazine/cc163567.aspx">CLR hosting API</A></STRONG>: allosw native application to host and fine-grain control the CLR and call into .NET components. However, having to handle all CLR hosting aspects manually is a significant overhead.</DIV></LI>
<LI>
<DIV mce_keep="true"><STRONG><A class="" href="https://msdn.microsoft.com/en-us/library/ms235289(VS.80).aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/ms235289(VS.80).aspx">C++/CLI</A></STRONG>: also known as <STRONG>I</STRONG>t <STRONG>J</STRONG>ust <STRONG>W</STRONG>orks(IJW), &nbsp;achieves interoperability at&nbsp;compiler level (C++, <A class="" href="https://msdn.microsoft.com/en-us/library/k8d11d4s.aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/k8d11d4s.aspx">/clr</A> compiler flag)&nbsp;by mixing native and managed code in a&nbsp;transparent way. It provides a lot of control on where the native/managed transition occurs and also provide high performance (basically,&nbsp;by transparently handling P/Invoke calls)</DIV></LI></UL>
<BLOCKQUOTE>
<BLOCKQUOTE>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>//Calling&nbsp;into managed code from C++ native MFC app:</FONT></SPAN></P><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes">
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><FONT face=Calibri><SPAN style="FONT-SIZE: 8pt; COLOR: blue; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes">using</SPAN><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">namespace</SPAN> ClassLibrary1;<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>…<o:p></o:p></FONT></SPAN></P></SPAN>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>END_MESSAGE_MAP()<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><o:p><FONT face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><FONT face=Calibri><SPAN style="FONT-SIZE: 8pt; COLOR: blue; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes">void</SPAN><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"> CallManagedFromMFC()<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>{<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Class1^ c = <SPAN style="COLOR: blue">gcnew</SPAN> Class1();<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">int</SPAN> result = c-&gt;Calculate(3,4);<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>CString str = String::Format(<SPAN style="COLOR: #a31515">"Result: {0}"</SPAN>, result);<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>AfxMessageBox(str);<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>}<o:p></o:p></FONT></SPAN></P>
<P mce_keep="true">&nbsp;</P></BLOCKQUOTE></BLOCKQUOTE>
<P mce_keep="true">Clearly, things don't always work seamlessly together when integrating native&nbsp;and&nbsp;managed code and one major&nbsp;aspect in a mixed-mode scenario is error and exception handling - simply because there are significant differences in the exception generation and handling mechanisms in different types of components, especially when&nbsp;crossing the native/managed border. </P>
<P mce_keep="true">One important thing to know&nbsp;is that the Common Language Runtime represents&nbsp;its managed exceptions as native SEH(<A class="" href="https://msdn.microsoft.com/en-us/library/ms680657(VS.85).aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/ms680657(VS.85).aspx">Structured Exception Handling</A>) exceptions and installs&nbsp;its own SEH filter for that&nbsp;- but the managed exception information is not carried in the SEH exception but rather managed internally in the CLR. This allows the CLR to fit quite well in a mixed application which is using also SEH. </P>
<P mce_keep="true">While you can get CLR exceptions as native SEH in&nbsp;a native&nbsp;<A class="" href="https://msdn.microsoft.com/en-us/library/ms681401(VS.85).aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/ms681401(VS.85).aspx">UnhandledExceptionFilter()</A>, you will not be able to access managed exception information - simply because only the CLR itself can access that information.If you&nbsp;are chaining&nbsp;a&nbsp;SEH &nbsp;UnhandledExceptionFilter() in your mixed application - which you should only do for good reason -&nbsp;there are two thighs to take into consideration:</P>
<UL>
<LI>
<DIV mce_keep="true">propelry chain your filter as a "good Win32 citizen" and call the previously set filter before doing your processing</DIV></LI>
<LI>
<DIV mce_keep="true">it is imperative&nbsp;not to&nbsp;interfere with the CLR SEH exceptions and always return EXCEPTION_CONTINUE_SEARCH for such exceptions - as for any exceptions you are not handling yourself: otherwise you can easily put the CLR in an undefined state.</DIV></LI></UL>
<P mce_keep="true">Here's a code snippet, again from a MFC Application which sets a trivial UnhandledExceptionFilter that should behave well with the CLR:</P>
<BLOCKQUOTE>
<BLOCKQUOTE>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><FONT face=Calibri><SPAN style="FONT-SIZE: 8pt; COLOR: blue; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes">#define</SPAN><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"> CLR_EXCEPTION_CODE 0xE0434F4D<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>LPTOP_LEVEL_EXCEPTION_FILTER topLevelEF;<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><o:p><FONT face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>LONG WINAPI UEFHandler(<SPAN style="COLOR: blue">struct</SPAN> _EXCEPTION_POINTERS *ExceptionInfo)<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>{<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// call previous handler first<o:p></o:p></SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>(*topLevelEF)(ExceptionInfo);<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>_EXCEPTION_RECORD *ExceptionRecord = ExceptionInfo-&gt;ExceptionRecord;<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><o:p><FONT face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (ExceptionRecord-&gt;ExceptionCode==CLR_EXCEPTION_CODE) <o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// CLR Exception in native handler<o:p></o:p></SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> EXCEPTION_CONTINUE_SEARCH;<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> EXCEPTION_CONTINUE_SEARCH;<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>}<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><o:p><FONT face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><o:p><FONT face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><o:p><FONT face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>BOOL CMfcTestApp::InitInstance()<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>{<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="FONT-SIZE: 8pt; LINE-HEIGHT: 115%; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>topLevelEF= SetUnhandledExceptionFilter(UEFHandler);</FONT></SPAN><SPAN style="FONT-SIZE: 8pt; LINE-HEIGHT: 115%"><o:p></o:p></SPAN></P></BLOCKQUOTE></BLOCKQUOTE>
<P mce_keep="true">As said, you will not be able to get managed exception information in a native handler - you must use try/catch in C++/CLI - that is, in a managed context - if you really need that information.</P>
<P mce_keep="true">Generally speaking, it is easier to deal with native errors/exceptions in managed code that the other way round, the main reason being that native code is unaware of managed concepts like managed exceptions, managed threads, application domains and so on. Let's see some common scenarios:</P>
<OL>
<LI>
<DIV mce_keep="true">P/Invoke is fairly straightforward: it is common practice to wrap your P/Invoke call in a try/catch block to get the exceptions generated by the call. You will get both exceptions generated by the P/Invoke service itself (like not finding the Dll or the entry point) and exceptions generated by the call itself. For Win32 functions, you can also retrieve the Win32 error code. See <A class="" href="https://msdn.microsoft.com/en-us/magazine/cc164123.aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/magazine/cc164123.aspx">here</A> for more details.</DIV></LI>
<LI>
<DIV mce_keep="true">In COM Interop, the runtime is&nbsp;converting COM HRESULT values to managed exceptions and the other way round: there is a layer of separation at the COM interfaces level. See here for further reading: <A href="https://msdn.microsoft.com/en-us/library/awy7adbx.aspx">https://msdn.microsoft.com/en-us/library/awy7adbx.aspx</A></DIV></LI>
<LI>
<DIV mce_keep="true">Ther CLR Hosting APIs allow extensive control of how CLR faults and exceptions are handled - but this is a fairly complex topic and most people prefer the C++/CLI approach</DIV></LI>
<LI>
<DIV mce_keep="true">C++/CLI provides a seamless exception handling approach for the programmer: you can catch both managed and native exceptions in <A class="" href="https://msdn.microsoft.com/en-us/library/k8d11d4s.aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/k8d11d4s.aspx">/clr</A> compiled code.&nbsp;&nbsp;</DIV></LI></OL>
<DIV mce_keep="true">Because CLR is using SEH, you will also get exceptions appropriately &nbsp;when calling managed code from say a native MFC app which, in turn, calls again into native code and so on - it is very useful to understand how this happens, which is very nicely explained &nbsp;in <A class="" href="https://msdn.microsoft.com/en-us/magazine/cc793966.aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/magazine/cc793966.aspx">this article</A>&nbsp;by Gaurav Khanna. There are a few things, that work differently when you host .NET code in a native application:</DIV>
<UL>
<LI>
<DIV mce_keep="true">because you are running on a thread that has not been created by the CLR, the CLR unhandled exception mechanism may not be triggered in some situations - actually, it will only be triggered if the native thread is calling into .NET outside of any SEH handler protection</DIV></LI>
<LI>
<DIV mce_keep="true">one side effect of this that I have encountered is that you will not get a AppDomain.UnhandledException Event in your application.This actually makes sense, as AppDomain is a purely managed concept.</DIV></LI></UL>
<BLOCKQUOTE>
<BLOCKQUOTE>
<P mce_keep="true">If you rely on AppDomain.UnhandledException to log errors in your managed code, this will not work when running managed code on a native thread. If you absolutely need to get detailed managed exception information in a central handler - which is NOT something recommended (catch-all is not a good practice) - you&nbsp;will have to try/catch managed exception on a native frame that&nbsp;will get them.&nbsp;From a troubleshooting point of view, it should be better to just let your app crash and thus get exception info (dump) post-mortem rather than unwinding the stack in a&nbsp;catch-all handler. For reference, however, here's how you can get managed exceptions&nbsp;by overriding&nbsp;OnCmdMsg() &nbsp;in a MFC app:</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>BOOL CMfcTestApp::OnCmdMsg(<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>UINT nID,<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">int</SPAN> nCode,<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">void</SPAN>* pExtra,<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>AFX_CMDHANDLERINFO* pHandlerInfo<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>)<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>{<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">try</SPAN><SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> CWinApp::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">catch</SPAN> (System::Exception ^ex)<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>System::Windows::Forms::MessageBox::Show(<SPAN style="COLOR: #a31515">"Whoops! Maneged exception."</SPAN>);<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> 0;<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="FONT-SIZE: 8pt; LINE-HEIGHT: 115%; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>}<SPAN style="mso-spacerun: yes">&nbsp; </SPAN></FONT></SPAN><SPAN style="FONT-SIZE: 8pt; LINE-HEIGHT: 115%"><o:p></o:p></SPAN></P>
<P mce_keep="true">&nbsp;</P></BLOCKQUOTE></BLOCKQUOTE>
<UL>
<LI>
<DIV mce_keep="true">Speaking of AppDomains: since this is a pure managed concept, the question arises: in&nbsp;which AppDomain will a native thread calling into .NET be running ? The CLR must pick an AppDomain and it will the AppDomain the thread was the last time it called into managed code - usually the default AppDomain. You can have some control over the AppDomain by using Delegates and <A class="" href="https://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.getfunctionpointerfordelegate.aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.getfunctionpointerfordelegate.aspx">Marshal<SPAN class=cpp>::</SPAN>GetFunctionPointerForDelegate()</A>&nbsp;, as Delegates keep a reference to their AppDomain.</DIV></LI></UL>
<DIV mce_keep="true">So next time you are planning an Interop scenario, you might find the above information useful for a check of the available options.</DIV>
<DIV mce_keep="true">&nbsp;</DIV>
<DIV mce_keep="true"><STRONG>References:</STRONG></DIV>
<DIV mce_keep="true">BorisJ's Interop 101s: <A href="https://blogs.msdn.com/borisj/archive/2006/07/29/683061.aspx">https://blogs.msdn.com/borisj/archive/2006/07/29/683061.aspx</A></DIV>
<DIV mce_keep="true"><A href="https://msdn.microsoft.com/en-us/magazine/cc163567.aspx">https://msdn.microsoft.com/en-us/magazine/cc163567.aspx</A></DIV>
<DIV mce_keep="true"><A href="https://msdn.microsoft.com/en-us/magazine/cc163971.aspx">https://msdn.microsoft.com/en-us/magazine/cc163971.aspx</A></DIV>
<DIV mce_keep="true"><A href="https://msdn.microsoft.com/en-us/magazine/cc793966.aspx">https://msdn.microsoft.com/en-us/magazine/cc793966.aspx</A></DIV>
<DIV mce_keep="true">&nbsp;</DIV>
<DIV mce_keep="true">&nbsp;</DIV>
<DIV mce_keep="true">&nbsp;</DIV>
<DIV mce_keep="true">&nbsp;</DIV>
<P mce_keep="true">&nbsp;</P>]]></content:encoded>
    </item>
    <item>
      <title>Publishing ClickOnce: manifest signing</title>
      <link>https://docs.microsoft.com/archive/blogs/liviuc/publishing-clickonce-manifest-signing</link>
      <pubDate>Mon, 14 Sep 2009 07:10:00 GMT</pubDate>
      <dc:creator><![CDATA[liviuc]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/liviuc/2009/09/14/publishing-clickonce-manifest-signing/</guid>
      <description><![CDATA[Despite the official MSDN docs being quite explicit, I often see questions to best practices on...]]></description>
      <content:encoded><![CDATA[<P>Despite the official MSDN docs being quite explicit, I often see questions to best practices on certificates for ClickOnce application deployment. Basically, there are two main scenarios:</P>
<OL>
<LI>Publishing ClickOnce applications for external users (Internet)</LI>
<LI>Publishing for a restricted group of internal users (Intranet)</LI></OL>
<P>An excellent document on the subject is here: <A href="https://msdn.microsoft.com/en-us/library/aa730868(VS.80).aspx" mce_href="https://msdn.microsoft.com/en-us/library/aa730868(VS.80).aspx">https://msdn.microsoft.com/en-us/library/aa730868(VS.80).aspx</A>&nbsp;</P>
<P>For the first scenario, it is generally clear that a trusted certificate signed by a Certificate Authority is needed in order to ensure that the application publisher is trusted. Additionally, Trusted Application Deployment (TAD) also requires a CA signed certificate: <A href="https://msdn.microsoft.com/en-us/library/01daf08f.aspx" mce_href="https://msdn.microsoft.com/en-us/library/01daf08f.aspx">https://msdn.microsoft.com/en-us/library/01daf08f.aspx</A></P>
<P mce_keep="true">The second type of scenario is often&nbsp;asked about&nbsp;for internal deployments in "trusted" smaller environments - like a developer team: the overhead of a CA certificate is considered unnecessary. Because ClickOnce works with self-signed certificates (like Personal Information Exchange&nbsp;.pfx ), this can be&nbsp;used as alternative. Following things need to be considered:</P>
<OL>
<LI>
<DIV mce_keep="true">By default, Visual Studio will automatically generate test certificates for you and add the PFX file to your project. If several developers need to be able to publish application updates, the they must use the same certificate (otherwise the update will fail)</DIV></LI>
<LI>So it should be OK to check the PFX with your project in source control and have all developers use&nbsp;it&nbsp;- Visual Studio will&nbsp;automatically import the PFX in the local certificate store of each machine where the project is published (ClickOnce manifest signing always works by first importing the PFX certificate in the local Certificate Store)</LI>
<LI>However, VisualStudio test certificates have a limited validity: they expire after one year. It is possible to extend them, but it's not worth the risk of forgetting when it expires (which will cause application updates to fail). A better options is available: creating and using a&nbsp;self-signed certificate with the .NET 2.0 makecert.exe Tool:</LI></OL>
<BLOCKQUOTE>
<P><A href="https://msdn.microsoft.com/en-us/library/e78byta0(VS.80).aspx" mce_href="https://msdn.microsoft.com/en-us/library/e78byta0(VS.80).aspx">https://msdn.microsoft.com/en-us/library/e78byta0(VS.80).aspx</A></P>
<P>The tool allows you to create a certificate with the desired expiration date and exporting this to a PFX file which can be used just like a Visual Studio test certificate.&nbsp;The private key can be password protected.</P></BLOCKQUOTE>
<P>As a side note in this scenario, you should periodically make sure your usage of&nbsp;self-signed certificates is really appropriate from a security point of view. </P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>]]></content:encoded>
    </item>
    <item>
      <title>TFS permissions and roles in SQL Server</title>
      <link>https://docs.microsoft.com/archive/blogs/liviuc/tfs-permissions-and-roles-in-sql-server</link>
      <pubDate>Mon, 17 Aug 2009 06:50:00 GMT</pubDate>
      <dc:creator><![CDATA[liviuc]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/liviuc/2009/08/17/tfs-permissions-and-roles-in-sql-server/</guid>
      <description><![CDATA[A question&nbsp;I have seen&nbsp;often asked by SQL Server DBAdmins hosting Team Foundation...]]></description>
      <content:encoded><![CDATA[<P>A question&nbsp;I have seen&nbsp;often asked by SQL Server DBAdmins hosting Team Foundation Server&nbsp;Databases on their server - as well as by some TFS Admins: what are the exact server/database roles and permissions that different TFS Accounts should have at a minimum on the different TFS databases ? Mostly, the question is to <STRONG>TFSService</STRONG> and <STRONG>TFSReports</STRONG>: clearly, TFSSETUP is an account that needs pretty much all kinds of Admin permissions.</P>
<P>&nbsp;I will try to shed some light on this:</P>
<UL>
<LI>First of all, there is currently no official Microsoft docs that describes such details. There is a reason for that: not only is manually touching the TFS (as well as Reporting Services and Sharepoint) databases, including permissions and roles, not recommended, but it can easily put you in an unsupported state (if you raise a support incident with MS). When TFS is installed, the configured database settings <STRONG><EM>should</EM></STRONG> work with all supported TFS operation and migration scenarios without requiring any manual touch of the databases (apart from backup/restores).</LI></UL>
<P mce_keep="true">&nbsp;</P>
<UL>
<LI>However, in troubleshooting scenarios it might be useful to check some basic things in the TFS-related databases:</LI>
<UL>
<LI><EM>Typically</EM>, <STRONG>TFSService</STRONG> is in the <STRONG>dbcreator</STRONG> and <STRONG>securityadmin</STRONG> Server Roles. If it is not, this is not necessarily an issue, but you might want to check if someone has done some manual configuration on SQL settings</LI>
<LI><STRONG>TFSService</STRONG> should have User Mappings to the following databases&nbsp;(names of the Sahrepoint DBs might vary&nbsp;):<EM> </EM><B>TFSActivityTracking, TFSBuild,TFSIntegration, TFSVersionControl, TFSWorkitemTracking, TFSWorkitemTrackingAttachements, TFSWarehouse STS_Config_TFS STS_Content_TFS </B></LI>
<LI><STRONG>TFSService</STRONG> should be in the <STRONG>TFSEXECROLE</STRONG> for all TFS-related databases. This is owned by <STRONG>dbo</STRONG>, which in turn grants <STRONG>db_owner</STRONG> to the TFS Databases.</LI>
<LI><STRONG>TFSReports</STRONG> should have a User Mapping on <STRONG>TFSWarehouse</STRONG></LI></UL></UL>
<BLOCKQUOTE>
<P>This list is not exhaustive, but rather something you should expect to see on a properly installed TFS (2005 and 2008)</P></BLOCKQUOTE>
<UL>
<LI>You&nbsp;might also check this blog post from the TFS Setup/Install Team: <A href="https://blogs.msdn.com/tfssetup/archive/2009/08/05/tfs-2008-permission-requirements-for-team-foundation-server-service-account.aspx" mce_href="https://blogs.msdn.com/tfssetup/archive/2009/08/05/tfs-2008-permission-requirements-for-team-foundation-server-service-account.aspx">https://blogs.msdn.com/tfssetup/archive/2009/08/05/tfs-2008-permission-requirements-for-team-foundation-server-service-account.aspx</A></LI></UL>
<BLOCKQUOTE>
<P>Please note the explicit reccomendation not to use these settings on a permanent basis or when servicing TFS!</P></BLOCKQUOTE>
<P>The morale:&nbsp;apart from obvious issues, you should stay away of manually configuring TFS databases manually. For troubleshooting, try using TFS Best Practices Analyzer (BPA, <A href="https://msdn.microsoft.com/en-us/teamsystem/bb980963.aspx" mce_href="https://msdn.microsoft.com/en-us/teamsystem/bb980963.aspx">https://msdn.microsoft.com/en-us/teamsystem/bb980963.aspx</A>) first, it should detect most database/SQL&nbsp;logins&nbsp;configuration issues.</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>]]></content:encoded>
    </item>
    <item>
      <title>VB6 and security in the Kill-Bit world</title>
      <link>https://docs.microsoft.com/archive/blogs/liviuc/vb6-and-security-in-the-kill-bit-world</link>
      <pubDate>Thu, 06 Aug 2009 08:08:00 GMT</pubDate>
      <dc:creator><![CDATA[liviuc]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/liviuc/2009/08/06/vb6-and-security-in-the-kill-bit-world/</guid>
      <description><![CDATA[VB6 runtime support 
&nbsp;
In spite of being a rather old technology, Visual Basic 6 code is...]]></description>
      <content:encoded><![CDATA[<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 12pt; mso-bidi-font-family: Arial; mso-bidi-font-size: 11.0pt"><FONT face=Calibri>VB6 runtime support <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>In spite of being a rather old technology, Visual Basic 6 code is still among us - to a suprisingly large extent. Some usual places where you find VB6 these days:<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-add-space: auto; mso-list: l0 level1 lfo1"><SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>VB6 desktop applications and custom controls<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-add-space: auto; mso-list: l0 level1 lfo1"><SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>VB6 ActiveX controls hosted on Web sites or in desktop applications (including .NET applications)<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-add-space: auto; mso-list: l0 level1 lfo1"><SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>VB6 ActiveX controls in Office VBA aplications<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><FONT size=3><FONT face=Calibri><SPAN style="mso-bidi-font-family: Arial">The support for VB6 IDE has ended on 8. April 2008, but Microsoft is committed to further supporting the so-called </SPAN><SPAN style="mso-bidi-font-family: 'Times New Roman'">Visual Basic 6.0 Runtime Extended Files</SPAN><SPAN style="mso-bidi-font-family: Arial">, which include most of the VB6 Controls originally shipped with the VB6 IDE, in order to allow legacy VB6 code to run even on newer operating systems. The details are here:<o:p></o:p></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><A href="https://msdn.microsoft.com/en-us/vbrun/ms788708.aspx" mce_href="https://msdn.microsoft.com/en-us/vbrun/ms788708.aspx"><FONT face=Calibri size=3>https://msdn.microsoft.com/en-us/vbrun/ms788708.aspx</FONT></A><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 12pt; mso-bidi-font-family: Arial; mso-bidi-font-size: 11.0pt"><FONT face=Calibri>Kill-bits<o:p></o:p></FONT></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><FONT face=Calibri size=3>Recently, we have seen an almost unprecedented effort in strengthening security on MS operating systems: as part of this effort, several vulnerabilities in the original releases in many VB6 ActiveX Controls have been discovered. The primary solution to address these issues was publishing several Security Bulletins and Advisories containing </FONT><A href="https://support.microsoft.com/default.aspx?scid=kb;EN-US;240797" mce_href="https://support.microsoft.com/default.aspx?scid=kb;EN-US;240797"><FONT face=Calibri size=3>Kill-Bits</FONT></A><FONT size=3><FONT face=Calibri> for the vulnerable ActiveX controls. What a Kill-Bit is and how it works is explained here:<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><A href="https://support.microsoft.com/default.aspx?scid=kb;EN-US;240797" mce_href="https://support.microsoft.com/default.aspx?scid=kb;EN-US;240797"><FONT face=Calibri size=3>https://support.microsoft.com/default.aspx?scid=kb;EN-US;240797</FONT></A><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>In short:<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-add-space: auto; mso-list: l3 level1 lfo2"><SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-weight: bold; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-style: italic"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>The "Compatibility Flags" register value under <B>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\<I>CLSID of the ActiveX control </I></B><SPAN style="mso-bidi-font-weight: bold; mso-bidi-font-style: italic">is set to a bit mask that prevents the ActiveX control to be instantiated<B><I><o:p></o:p></I></B></SPAN></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><B><I><SPAN style="mso-bidi-font-family: 'Times New Roman'"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></I></B></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-add-space: auto; mso-list: l3 level1 lfo2"><SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>Optionally, an <B style="mso-bidi-font-weight: normal">AlternateCLSID</B> for a new version of the control in which the vulnerability has been fixed is provided. <SPAN style="mso-spacerun: yes">&nbsp;</SPAN>This allows the transparent instantiation of the new control via the old CLSID <SPAN style="mso-spacerun: yes">&nbsp;</SPAN>(the system is doing this redirection for you). <SPAN style="mso-spacerun: yes">&nbsp;</SPAN>There are some catches to this with licensing issues - as described below.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>An important note: Kill-Bits do <B style="mso-bidi-font-weight: normal"><I style="mso-bidi-font-style: normal">not</I></B> only affect<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Internet Explorer - I have encountered this misunderstanding quite often. What applications respect the Kill-Bits - as well as a wealth of other <SPAN style="mso-spacerun: yes">&nbsp;</SPAN>infos on Kill-Bits - you can read here:<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><A href="https://blogs.technet.com/srd/archive/2008/02/06/The-Kill_2D00_Bit-FAQ_3A00_-Part-1-of-3.aspx" mce_href="https://blogs.technet.com/srd/archive/2008/02/06/The-Kill_2D00_Bit-FAQ_3A00_-Part-1-of-3.aspx"><FONT face=Calibri size=3>https://blogs.technet.com/srd/archive/2008/02/06/The-Kill_2D00_Bit-FAQ_3A00_-Part-1-of-3.aspx</FONT></A><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><A href="https://blogs.technet.com/srd/archive/2008/02/06/The-Kill_2D00_Bit-FAQ_3A00_-Part-2-of-3.aspx" mce_href="https://blogs.technet.com/srd/archive/2008/02/06/The-Kill_2D00_Bit-FAQ_3A00_-Part-2-of-3.aspx"><FONT face=Calibri color=#0000ff size=3>https://blogs.technet.com/srd/archive/2008/02/06/The-Kill_2D00_Bit-FAQ_3A00_-Part-2-of-3.aspx</FONT></A><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><A href="https://blogs.technet.com/srd/archive/2008/02/06/The-Kill_2D00_Bit-FAQ_3A00_-Part-3-of-3.aspx" mce_href="https://blogs.technet.com/srd/archive/2008/02/06/The-Kill_2D00_Bit-FAQ_3A00_-Part-3-of-3.aspx"><FONT face=Calibri color=#0000ff size=3>https://blogs.technet.com/srd/archive/2008/02/06/The-Kill_2D00_Bit-FAQ_3A00_-Part-3-of-3.aspx</FONT></A><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"><FONT face=Calibri><B><SPAN style="FONT-SIZE: 10pt; mso-bidi-font-family: 'Times New Roman'; mso-bidi-font-size: 11.0pt">What applications respect the Kill-Bit?</SPAN></B><SPAN style="FONT-SIZE: 10pt; mso-bidi-font-family: 'Times New Roman'; mso-bidi-font-size: 11.0pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; mso-bidi-font-family: 'Times New Roman'; mso-bidi-font-size: 11.0pt"><FONT face=Calibri>The Kill-Bit is respected in Internet Explorer (all zones) and also in Microsoft Office scenarios where objects are embedded within documents. The Kill-Bit should also be effective by default in any other application or platform that hosts the IE browser’s rendering engine (MSHTML). <o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>In addition to the Kill-Bit mechanism <I style="mso-bidi-font-style: normal">per se</I>, upgrading Kill-Bit-ed controls to new, unblocked versions using <B style="mso-bidi-font-weight: normal">AlternateCLSIDs</B> can also lead to licensing issues in applications that would otherwise ignore the Kill-Bit (as described <SPAN style="mso-spacerun: yes">&nbsp;</SPAN>below).<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 12pt; mso-bidi-font-family: Arial; mso-bidi-font-size: 11.0pt"><FONT face=Calibri>How can I be affected<o:p></o:p></FONT></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>If you are – maybe without even realizing - using VB6 components in applications on your computer/server, sooner or later you will probably come across Kill-Bits - either because you install one of the<B style="mso-bidi-font-weight: normal"> MS Security Bulletins</B> containing Kill-Bits or because this is automatically installed by Windows Update (some of the vulnerabilities are rated critical, so installing the patches do by far more good than bad !)<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>Kill-Bits Security bulletins are cumulative, the most recent ist:<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><A href="https://www.microsoft.com/technet/security/bulletin/ms09-032.mspx" mce_href="https://www.microsoft.com/technet/security/bulletin/ms09-032.mspx"><FONT face=Calibri size=3>https://www.microsoft.com/technet/security/bulletin/ms09-032.mspx</FONT></A><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><B><SPAN style="mso-bidi-font-family: 'Times New Roman'"><FONT face=Calibri size=3>What kill bits does this Cumulative Security Update of ActiveX Kill Bits contain?</FONT></SPAN></B><SPAN style="mso-bidi-font-family: 'Times New Roman'"><FONT face=Calibri size=3> <BR>This Cumulative Security Update of ActiveX Kill Bits contains all kill bits previously released in </FONT><A href="https://www.microsoft.com/technet/security/bulletin/ms08-023.mspx" mce_href="https://www.microsoft.com/technet/security/bulletin/ms08-023.mspx"><SPAN style="COLOR: blue"><FONT face=Calibri size=3>MS08-023</FONT></SPAN></A><FONT face=Calibri size=3>, Security Update of ActiveX Kill Bits; </FONT><A href="https://www.microsoft.com/technet/security/bulletin/ms08-032.mspx" mce_href="https://www.microsoft.com/technet/security/bulletin/ms08-032.mspx"><SPAN style="COLOR: blue"><FONT face=Calibri size=3>MS08-032</FONT></SPAN></A><FONT face=Calibri size=3>, Cumulative Security Update of ActiveX Kill Bits; and advisories entitled Update Rollup for ActiveX Kill Bits, </FONT><A href="https://www.microsoft.com/technet/security/advisory/953839.mspx" mce_href="https://www.microsoft.com/technet/security/advisory/953839.mspx"><SPAN style="COLOR: blue"><FONT face=Calibri size=3>Microsoft Security Advisory 953839</FONT></SPAN></A><FONT face=Calibri size=3>, </FONT><A href="https://www.microsoft.com/technet/security/advisory/956391.mspx" mce_href="https://www.microsoft.com/technet/security/advisory/956391.mspx"><SPAN style="COLOR: blue"><FONT face=Calibri size=3>Microsoft Security Advisory 956391</FONT></SPAN></A><FONT face=Calibri size=3>, </FONT><A href="https://www.microsoft.com/technet/security/advisory/960715.mspx" mce_href="https://www.microsoft.com/technet/security/advisory/960715.mspx"><SPAN style="COLOR: blue"><FONT face=Calibri size=3>Microsoft Security Advisory 960715</FONT></SPAN></A><FONT face=Calibri size=3>, and </FONT><A href="https://www.microsoft.com/technet/security/advisory/969898.mspx" mce_href="https://www.microsoft.com/technet/security/advisory/969898.mspx"><SPAN style="COLOR: blue"><FONT face=Calibri size=3>Microsoft Security Advisory 969898</FONT></SPAN></A><FONT size=3><FONT face=Calibri>.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>So what do you do if one of the Kill-Bit Security Updates is breaking your application, web site or Office VBA code<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>that uses VB6 Controls ? First of all, make sure the control that has stopped working is indeed part of the supported VB6 Runtime: <SPAN style="mso-spacerun: yes">&nbsp;</SPAN>you can look it up in the <B style="mso-bidi-font-weight: normal">Cumulative Rollup for the VB6 SP6 Runtime Extended Files</B>:<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><A href="https://support.microsoft.com/kb/957924" mce_href="https://support.microsoft.com/kb/957924"><FONT face=Calibri size=3>https://support.microsoft.com/kb/957924</FONT></A><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>This contains new versions of VB6 Controls that replace the old, vulnerable ones by redirecting them to AlternateCLSIDs so that the Kill-Bits are no longer blocking them. <SPAN style="mso-spacerun: yes">&nbsp;</SPAN>You need to get these updated versions o VB6 controls onto the affected computers.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>At this point, there is one important mention to be made: you cannot simply install this patch on an affected machine - it will only install on a machine with a VB6 IDE license. The reason is simple: VB6 Controls are licensed controls that can only be redistributed by packing them in your VB6 application setup. <o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>So how do you get the new VB6 Controls on the machines where KillBits have disabled your VB6 code functionality ? The answer is: it depends on the application.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-add-space: auto; mso-list: l1 level1 lfo3"><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>1.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>A "pure" <B style="mso-bidi-font-weight: normal">VB6 application</B> or control running in a Kill Bit-unaware application can still run with killbit-ed VB6 Controls. However, it is still a good idea to install KB 957924 on the development machine with VB6 IDE, recompile your VB6 code there and the re-deploy your application<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>with the new VB6 Controls.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>The reason is that, if you don't recompile your code with the new controls from KB 957924 and later deploy these controls as part of a Kill Bit-aware applications that requires them, you<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>will run into <B style="mso-bidi-font-weight: normal">licensing issues</B> on the target machines when running the VB6 app. This is because the runtime license for VB6 controls that is embedded in your old application or custom control is not valid for the new version of the control, which has a different CLSID. Therefore, when you run the app on the target machine, the runtime license will be invalid and - if no design-time license is present, which should only be the case on a machine with VB6 IDE - the instantiation of the control will fail and you will most probably see something like this:<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-no-proof: yes"><?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:shapetype id=_x0000_t75 coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></v:path><o:lock v:ext="edit" aspectratio="t"></o:lock></v:shapetype></SPAN></B><SPAN style="mso-bidi-font-family: Arial"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3><IMG style="WIDTH: 697px; HEIGHT: 128px" height=128 src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/85/91/05/VB6%20error.jpg" original-url="https://blogs.msdn.com/photos/liviuc/images/9859105/original.aspx" width=697 mce_src="https://blogs.msdn.com/photos/liviuc/images/9859105/original.aspx">&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>The morale is: simply recompile your VB6 code with KB 957924 controls, redeploy and save yourself the hassle. <o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-add-space: auto; mso-list: l1 level1 lfo3"><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>2.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>If you are hosting VB6 controls on a <B style="mso-bidi-font-weight: normal">web site</B>, you will need to deploy the KB 957924 controls and, additionally, you will run into the LPK (license file for hosting in IE) issue as described here:<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><A href="https://blogs.msdn.com/askie/archive/2009/02/20/certain-vb-controls-no-longer-display-on-web-pages-after-installing-kb960715.aspx" mce_href="https://blogs.msdn.com/askie/archive/2009/02/20/certain-vb-controls-no-longer-display-on-web-pages-after-installing-kb960715.aspx"><FONT face=Calibri size=3>https://blogs.msdn.com/askie/archive/2009/02/20/certain-vb-controls-no-longer-display-on-web-pages-after-installing-kb960715.aspx</FONT></A><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>Currently, the only workaround is to call <B style="mso-bidi-font-weight: normal">Microsoft Support</B> and get an updated <B style="mso-bidi-font-weight: normal">LPK</B> file for the controls. As the above blog post suggests, some work is currently done on the Internet Explorer client side to enable instantiation with the old LPK file and alleviate the issue.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-add-space: auto; mso-list: l1 level1 lfo3"><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>3.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>If you have issues with <B style="mso-bidi-font-weight: normal">Office VBA</B> components (which are <B style="mso-bidi-font-weight: normal">Kill-Bit aware</B> !), read this excellent blog post from the Visual Studio Office Dev Team here:<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><A href="https://blogs.msdn.com/vsod/archive/2009/06/05/visual-basic-6-controls-stop-working-after-security-advisory-960715.aspx" mce_href="https://blogs.msdn.com/vsod/archive/2009/06/05/visual-basic-6-controls-stop-working-after-security-advisory-960715.aspx"><FONT face=Calibri size=3>https://blogs.msdn.com/vsod/archive/2009/06/05/visual-basic-6-controls-stop-working-after-security-advisory-960715.aspx</FONT></A><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>The preferred way to deal with this is to rebuild your Office VBA component on a VB6 machine with the updated controls.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Other resources:</FONT></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo4"><SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Stay updated on Security Updates<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>and bulletins on the Microsoft Security Research &amp; Defense blog: </FONT><A href="https://blogs.technet.com/srd/" mce_href="https://blogs.technet.com/srd/"><FONT face=Calibri size=3>https://blogs.technet.com/srd/</FONT></A></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>]]></content:encoded>
    </item>
  </channel>
</rss>