Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / August 2003

Tip: Looking for answers? Try searching our database.

CCW and method parameters being classes?????

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jos? Joye - 28 Aug 2003 16:31 GMT
Hello,

I'm having a problem with CCW and method parameters. Some of the parameters
are classes.
It seems that these classes (or at least the properties inside the class)
are not seen from my VB client
Do I have to declare an interface for these classes (eg. TransModes)? If
yes, does anyone know the syntax?

Thanks a lot,
Jos?

Code snippet:
=========

   [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
   [Guid("1930F351-E6B3-4706-8784-562F7B541340")]
   public interface _UFSStatusAccess
   {
       TerminationCode Init (int nTestLevel, out string strErrDescr);

       TerminationCode Terminate (out string strErrDescr);

       TerminationCode GetTransmissionMode (bool UseCaching, out TransModes
UFSMode, out string strErrDescr);
    }

   [Serializable]
   public enum TerminationCode:int
   {
       eOK          = 0,
       eErrXXX   = 1,
       eErrNoConfirmation      = 8901,
       eErrInitNotSuccessfull  = 8902,
       eWngXXX                 = 189000,
       eWngNoCommunication     = 189001,
       eInfXXX                 = 28900,
       eDBGXXX                 = 38900
   }

   [Serializable]
   public class TransModes
   {
       public bool            m_Online;
       public bool            m_MemoryMode;
   }
Jos? Joye - 28 Aug 2003 20:35 GMT
I went a bit further. In fact, I think the parameters which as classes
should be interfaces as well. So I get my hand durty and did it...
However, the VB code does not get the object as prepared in managed coded.

Any idea?

Code snippet:
=========

   [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
   [Guid("1930F351-E6B3-4706-8784-562F7B541340")]
   public interface _UFSStatusAccess
   {

       TerminationCode GetTransmissionMode (bool UseCaching, out TransModes
UFSMode, out string strErrDescr);
    }

   [Serializable]
   public enum TerminationCode:int
   {
       eOK          = 0,
       eErrXXX   = 1,
       eErrNoConfirmation      = 8901,
       eErrInitNotSuccessfull  = 8902,
       eWngXXX                 = 189000,
       eWngNoCommunication     = 189001,
       eInfXXX                 = 28900,
       eDBGXXX                 = 38900
   }

   [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
   [Guid("B758299E-A024-40b3-9740-A35CA7A9D378")]
   public interface ITransModes
   {
       /// <summary>Is UFS currently online?</summary>
       bool Online {get; set;}
       /// <summary>Is UFS currently in memory mode?</summary>
       bool MemoryMode {get; set;}
   }

Then I have classes that implements the IF:

   [Serializable]
   public class TransModes : ITransModes
   {
       public TransModes() {}

       public  bool Online {get{return m_Online;} set{m_Online = value;}}
       public bool MemoryMode {get{return m_MemoryMode;} set{m_MemoryMode =
value;}}

       // Class members that will hold the states
       public bool m_Online;
       public bool m_MemoryMode;
   }

      public TerminationCode GetTransmissionMode (bool UseCaching, out
ITransModes UFSTransMode, out string strErrDescr)
       {
           try
           {
               UFSTransMode = new TransModes();
               TransModes UFSTransModeEx = (TransModes)UFSTransMode;

               return m_UFS.GetTransmissionMode(UseCaching, out
UFSTransModeEx, out strErrDescr);
  --> at this point the UFSTransModeEx has valid values.....

           }
           catch (Exception ex)
           {
               UFSTransMode = new TransModes();
               strErrDescr = "Error occured while trying to get UFS
transmission modes. Err: " + ex.Message;
               return TerminationCode.eErrXXX;
           }
       }

VB PART:
========

Private UFSStatus As New UFSStatusProvider.UFSStatusAccess

Private Sub Test_Click()

Dim errMsg As String
Dim stat As UFSStatusProvider.TerminationCode
Dim Mode As UFSStatusProvider.ITransModes

Set Mode = CreateObject("UFSStatusProvider.TransModes")

stat = TerminationCode_eErrXXX
Mode.MemoryMode = True
Mode.Online = False
stat = TerminationCode_eErrXXX
stat = UFSStatus.GetTransmissionMode(True, Mode, errMsg)

'---------------> stat and errMsg are returned ok... Mode not :-((

End Sub

============================================================================
=======
> Hello,
>
[quoted text clipped - 42 lines]
>         public bool            m_MemoryMode;
>     }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.