Groups | Blog | Home
all groups > dotnet interop > january 2007 >

dotnet interop : Calling .net window using COM


Feldaspar
1/15/2007 10:08:11 PM
Hi,

I'm trying to call a .net window using COM, this my .net code:

-------------------------------------------------------------
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("Hcn.Cv.CVSupportPrompt.1")]
[Guid("8DFA5C56-A510-11DB-AB24-9F7255D89593")]
public class CreatePrompt:MarshalByRefObject,ICreatePrompt
{
public void Create()
{
CVSupportPrompt prompt = new CVSupportPrompt(); //CVSupportPrompt is
just Form
prompt.ShowDialog();
}
}


[ComVisible(true)]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ICreatePrompt
{
void Create();
}

-------------------------------------------------------------

I have this in my post build event to create the tlb file, which seems
to work OK as the file is built:

c:\windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe
%targetdir%$(TargetFileName) /tlb:%targetdir%$(TargetFileName).tlb

This is my code I am trying to call from using CA-Visual Objects:

-------------------------------------------------------------
FUNCTION CheckShowCVPrompt() AS VOID

LOCAL CVPrompt,Factory AS OBJECT
Factory := oleautoobject{"HCN.Cv.CVSupportPrompt.1"}
CVPrompt := Factory:Create()
-------------------------------------------------------------

Nothing happens though when I run it, no window appears as would be
expected.

Regards,
Feldaspar
1/15/2007 10:10:22 PM
Hi sorry,

I just figured it out after I posted it I had mispelled:

Factory := oleautoobject{"HCN.Cv.CVSupportPrompt.1"}

It should be:
Factory := oleautoobject{"Hcn.Cv.CVSupportPrompt.1"}


[quoted text, click to view]
AddThis Social Bookmark Button