CCW and method parameters being classes?????

  • Thread starter Thread starter José Joye
  • Start date Start date
J

José Joye

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;
}
 
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




============================================================================
=======
José Joye said:
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;
}
 
Back
Top