阅读:1203回复:0
请教关于COM组件的问题??
<P align=left>对于上面的<FONT face="Times New Roman">.NET2003</FONT>代码有几个疑问的地方:</P>
<P align=left><FONT face="Times New Roman">1</FONT>、<FONT face="Times New Roman"> Public Const ClassId As String = "<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="9" UnitName="a">9A</st1:chmetcnv><st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="960" UnitName="F">0960F</st1:chmetcnv>9<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="True" HasSpace="False" SourceValue="7" UnitName="C">-7C</st1:chmetcnv>27<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="True" HasSpace="False" SourceValue="45" UnitName="F">-45F</st1:chmetcnv>4-8D<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="1" UnitName="F">1F</st1:chmetcnv>-A<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="1889" UnitName="C">01889C</st1:chmetcnv>4AB41"</FONT>这个<FONT face="Times New Roman">ClassId</FONT>应该是为AddDateTool类设置的吧?</P> <P align=left><FONT face="Times New Roman"> Public Const InterfaceId As String = "<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="738127" UnitName="a">738127A</st1:chmetcnv>3-B471-48CF-8937-0EF289981828"</FONT>当类中实现了多个接口时,<FONT face="Times New Roman">InterfaceId</FONT>是为哪个接口设置的??</P> <P align=left><FONT face="Times New Roman">Public Const EventsId As String = "<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="83" UnitName="a">83A</st1:chmetcnv>61D79-BECD-4AAC-82FD-F<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="5" UnitName="C">5C</st1:chmetcnv>0CE1FCBB8"</FONT>当类中有多个事件时,<FONT face="Times New Roman">InterfaceId</FONT>是为哪个接口设置的??</P> <P align=left>不知<FONT face="Times New Roman">ClassId</FONT>、<FONT face="Times New Roman">t InterfaceId </FONT>和<FONT face="Times New Roman">EventsId</FONT>怎么理解??</P> <P align=left><FONT face="Times New Roman">2</FONT>、<FONT face="Times New Roman">ClassId</FONT>、<FONT face="Times New Roman">t InterfaceId </FONT>和<FONT face="Times New Roman">EventsId</FONT>值<FONT face="Times New Roman">"<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="9" UnitName="a">9A</st1:chmetcnv><st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="960" UnitName="F">0960F</st1:chmetcnv>9<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="True" HasSpace="False" SourceValue="7" UnitName="C">-7C</st1:chmetcnv>27<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="True" HasSpace="False" SourceValue="45" UnitName="F">-45F</st1:chmetcnv>4-8D<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="1" UnitName="F">1F</st1:chmetcnv>-A<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="1889" UnitName="C">01889C</st1:chmetcnv>4AB41"</FONT>、<FONT face="Times New Roman">"<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="738127" UnitName="a">738127A</st1:chmetcnv>3-B471-48CF-8937-0EF289981828"</FONT>和<FONT face="Times New Roman">"<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="83" UnitName="a">83A</st1:chmetcnv>61D79-BECD-4AAC-82FD-F<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="5" UnitName="C">5C</st1:chmetcnv>0CE1FCBB8"是怎么得来呢?? 是用GuidTool.exe工具生成的吗??万分感谢!</P><p></p></FONT> <P align=left><ComClass(AddDateTool.ClassId, AddDateTool.InterfaceId, AddDateTool.EventsId)> _<p></p></P> <P align=left>Public NotInheritable Class AddDateTool<p></p></P> <P align=left> Inherits BaseTool 'Inherit the ESRI base command<p></p></P> <P align=left> Private m_pHookHelper As IHookHelper 'The hook that is passed to the OnCreate event<p></p></P> <P align=left><p> </p></P> <P align=left>#Region "COM GUIDs"<p></p></P> <P align=left> ' These GUIDs provide the COM identity for this class <p></p></P> <P align=left> ' and its COM interfaces. If you change them, existing <p></p></P> <P align=left> ' clients will no longer be able to access the class.<p></p></P> <P align=left> Public Const ClassId As String = "<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="9" UnitName="a">9A</st1:chmetcnv><st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="960" UnitName="F">0960F</st1:chmetcnv>9<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="True" HasSpace="False" SourceValue="7" UnitName="C">-7C</st1:chmetcnv>27<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="True" HasSpace="False" SourceValue="45" UnitName="F">-45F</st1:chmetcnv>4-8D<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="1" UnitName="F">1F</st1:chmetcnv>-A<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="1889" UnitName="C">01889C</st1:chmetcnv>4AB41"<p></p></P> <P align=left> Public Const InterfaceId As String = "<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="738127" UnitName="a">738127A</st1:chmetcnv>3-B471-48CF-8937-0EF289981828"<p></p></P> <P align=left> Public Const EventsId As String = "<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="83" UnitName="a">83A</st1:chmetcnv>61D79-BECD-4AAC-82FD-F<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="5" UnitName="C">5C</st1:chmetcnv>0CE1FCBB8"<p></p></P> <P align=left>#End Region<p></p></P> <P align=left> 'Register in the 'ESRI Controls Commands' component category<p></p></P> <P align=left>#Region "Component Category Registration"<p></p></P> <P align=left> <ComRegisterFunction(), ComVisible(False)> _<p></p></P> <P align=left> Public Shared Sub RegisterFunction(ByVal sKey As String)<p></p></P> <P align=left> Dim fullKey As String = sKey.Remove(0, 18) ; "\Implemented Categories"<p></p></P> <P align=left> Dim regKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(fullKey, True)<p></p></P> <P align=left> If Not (regKey Is Nothing) Then<p></p></P> <P align=left> regKey.CreateSubKey("{B284D891-22EE<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="True" HasSpace="False" SourceValue="4" UnitName="F">-4F</st1:chmetcnv>12-A<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="0" UnitName="a">0A</st1:chmetcnv>9-B1DDED<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="9197" UnitName="F">9197F</st1:chmetcnv>4}")<p></p></P> <P align=left> End If<p></p></P> <P align=left> End Sub<p></p></P> <P align=left> <ComUnregisterFunction(), ComVisible(False)> _<p></p></P> <P align=left> Public Shared Sub UnregisterFunction(ByVal sKey As String)<p></p></P> <P align=left> Dim fullKey As String = sKey.Remove(0, 18) ; "\Implemented Categories"<p></p></P> <P align=left> Dim regKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(fullKey, True)<p></p></P> <P align=left> If Not (regKey Is Nothing) Then<p></p></P> <P align=left> regKey.DeleteSubKey("{B284D891-22EE<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="True" HasSpace="False" SourceValue="4" UnitName="F">-4F</st1:chmetcnv>12-A<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="0" UnitName="a">0A</st1:chmetcnv>9-B1DDED<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="9197" UnitName="F">9197F</st1:chmetcnv>4}")<p></p></P> <P align=left> End If<p></p></P> <P align=left> End Sub<p></p></P> <P align=left>#End Region<p></p></P> |
|