[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

COM object that has been seperated from it's underlying RCW cannot be used

Feldaspar

7/19/2007 2:49:00 AM

Hi,

I have created a .net control and I have made it com visible and I am
consuming it from within Visual Objects code. But i get the following
error when calling the CreateDisplay() method:

COM object that has been seperated from it's underlying RCW cannot be
used.

It seems to happen when i try to change some viewable element of the
control. In this case I am trying to change the background colour.
Anyone have any ideas to try?
---

Here is my class:

[ComVisible(true)]
[Guid("4afe0275-1eb1-4d1c-b4b1-c0c795d76d1f")]
[ProgId("Thing.Photo.CurrentPhotoDisplay.5")]
[ComDefaultInterface(typeof(ICurrentPhotoDisplay))]
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(ICurrentPhotoDisplay))]
public class CurrentPhotoDisplay : Control,ICurrentPhotoDisplay
{
private PhotoDisplay CurrentPhoto;

public CurrentPhotoDisplay()
{
InitializeComponent();
}

private void InitializeComponent()
{
...............
}

public void CreateDisplay(int ID)
{
MessageBox.Show(ID.ToString());
BackColor = Color.Black; ///ERROR HAPPENS HERE
}

[ComRegisterFunction]
public static void RegisterClass(string key)
{
.........
}

[ComUnregisterFunction]
public static void UnregisterClass(string key)
{
............
}

}