<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.dotnetzone.gr:443/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>.NET Framework</title><link>https://www.dotnetzone.gr:443/cs/forums/14/ShowForum.aspx</link><description>Θέματα για threading, remoting, reflection, exception handling, security, regex κλπ.</description><dc:language>el</dc:language><generator>CommunityServer 2.1 SP3 (Build: 20423.1)</generator><item><title>.Net COM wrapper και Properties</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/9195.aspx</link><pubDate>Fri, 03 Feb 2006 23:11:11 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:9195</guid><dc:creator>BasiliZ</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/9195.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=14&amp;PostID=9195</wfw:commentRss><description>Καλησπέρα, θέλω να φτίαξω ένα .Net Com class που να μπορώ να το χρησιμοποιώ απο την vb6. Εχω κάνει τα εξής:&lt;br&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;namespace&lt;/span&gt; ClassLibrary1&lt;br /&gt;{&lt;br /&gt;    [Guid(&lt;span style="color: #666666;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;"D7426A5F-8689-4fcb-8318-328E19B1F088"&lt;/span&gt;)]&lt;br /&gt;    [ClassInterface(ClassInterfaceType.None)]&lt;br /&gt;    [ComDefaultInterface(&lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;typeof&lt;/span&gt;(IClass1))]&lt;br /&gt;    &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;public&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;class&lt;/span&gt; Class1 : ClassLibrary1.IClass1&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;public&lt;/span&gt; Class1() { }&lt;br /&gt;        &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;double&lt;/span&gt; [] pt &lt;span style="color: Red;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;new&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;double&lt;/span&gt;[]{0,0,0};&lt;br /&gt;        [DispId(2)]&lt;br /&gt;        &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;public&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;int&lt;/span&gt; IntValue { get { &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;return&lt;/span&gt; 1; } set { } }&lt;br /&gt;        [DispId(1)]&lt;br /&gt;        &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;public&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;object&lt;/span&gt; CenterPoint&lt;br /&gt;        {&lt;br /&gt;            get&lt;br /&gt;            {&lt;br /&gt;                &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;return&lt;/span&gt; pt;&lt;br /&gt;            }&lt;br /&gt;            &lt;span style="color: Green;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;//[param: In, MarshalAs(UnmanagedType.Struct)]&lt;/span&gt;&lt;br /&gt;            set&lt;br /&gt;            {&lt;br /&gt;                &lt;span style="color: Green;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;//; pt = (double[])value;&lt;/span&gt;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    [Guid(&lt;span style="color: #666666;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;"9509FBAF-A16A-4193-B0C2-E9B7C86C75BE"&lt;/span&gt;)]&lt;br /&gt;    &lt;span style="color: Green;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;//[TypeLibType(0x1040)]&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;public&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;interface&lt;/span&gt; IClass1&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;object&lt;/span&gt; CenterPoint { get; set; }&lt;br /&gt;        &lt;span style="color: Blue;background-color: Transparent;font-family: Lucida Console;font-size: 11px;font-weight: normal;"&gt;int&lt;/span&gt; IntValue { get; set; }&lt;br /&gt;    }&lt;br /&gt;}&lt;/span&gt;&lt;br&gt;&lt;br&gt;και αυτό που θέλω να γίνεται απο την vb6 ειναι το εξής απλό:&lt;br&gt;&lt;br&gt;Dim a As ClassLibrary1.Class1&lt;br&gt;Set a = New Class1&lt;br&gt;dim p as Variant&lt;br&gt;set p=a.CenterPoint 'ayto douleyei mia xara&lt;br&gt;a.CenterPoint= array(1.0,1.0,1.0) '&lt;b&gt;ayto petaei object required error 424 kai me set kai me let&lt;/b&gt;&lt;br&gt;&lt;br&gt;εχω δοκιμάσει παρα πολά και διαφορετικά πράγματα όπως το ClassInterfaceType.AutoDispach που ναι μεν λύνει το πρόβλημα αλλα στο intellisence και στον object browser δεν βλέπω τα properties. Πρέπει να κάνω marshalas και αν ναι σε τι type;&lt;br&gt;&lt;br&gt;Ευχαριστώ προκαταβολικά.&lt;br&gt;</description></item></channel></rss>