hello all,
msdn says this about using a dotnet windows control library in activex
environment...
You have to write one relatively small piece of code to make your .NET
control accessible to ActiveX hosts. ActiveX controls make several
registry entries that standard COM servers don't, so you have to add
this functionality to your .NET control. The CLR contains
prefabricated functions that will make and remove these entries. These
go by the names Control.ActiveX Register and Control.ActiveX Unregister.
You need to provide two external functions in your control class
marked with attributes that tell the .NET COM registration utility to
call them during the registration process. These functions need to
delegate to ActiveXRegister and ActiveXUnregist er.
------------------------------------------------------------------
.NET Registration as an ActiveX Control
Public Shared Sub <System.Runtime .InteropService s.ComRegisterFu nction()>
_
AxRegister(ByVa l regKey As String)
Dim foo As New Control1()
ActiveXRegister (foo.GetType)
End Sub
Public Shared Sub <System.Runtime .InteropService s.ComUnregister Function()>
_
AxUnregister(By Val regkey As String)
Dim foo As New Control1()
ActiveXUnregist er(foo.GetType)
End Sub
------------------------------------------------------------------
That's the only extra piece of code that you have to write today, and
I wouldn't be surprised if it moved into the base class in some future
version.
now i did it... and it wouldn't work. first it was giving me a compile
time error saying identifier expected. so i moved the attribute tags
before public like this...
------------------------------------------------------------------
<System.Runtime .InteropService s.ComRegisterFu nction()> _
Public Shared Sub AxRegister(ByVa l regKey As String)
Dim foo As New QueryControl()
ActiveXRegister (foo.GetType)
End Sub
<System.Runtime .InteropService s.ComUnregister Function()> _
Public Shared Sub AxUnregister(By Val regkey As String)
Dim foo As New QueryControl()
ActiveXUnregist er(foo.GetType)
End Sub
-------------------------------------------------------------------
now the identifier expected error went away... but new errors popped
up...
Name 'ActiveXRegiste r' is not declared.
Name 'ActiveXUnregis ter' is not declared.
now what is that supposed to mean...it is not able to identify the
methods activexRegister and activexunregist er for some reason... am i
missing something...?
regards,
Nilotpal
msdn says this about using a dotnet windows control library in activex
environment...
You have to write one relatively small piece of code to make your .NET
control accessible to ActiveX hosts. ActiveX controls make several
registry entries that standard COM servers don't, so you have to add
this functionality to your .NET control. The CLR contains
prefabricated functions that will make and remove these entries. These
go by the names Control.ActiveX Register and Control.ActiveX Unregister.
You need to provide two external functions in your control class
marked with attributes that tell the .NET COM registration utility to
call them during the registration process. These functions need to
delegate to ActiveXRegister and ActiveXUnregist er.
------------------------------------------------------------------
.NET Registration as an ActiveX Control
Public Shared Sub <System.Runtime .InteropService s.ComRegisterFu nction()>
_
AxRegister(ByVa l regKey As String)
Dim foo As New Control1()
ActiveXRegister (foo.GetType)
End Sub
Public Shared Sub <System.Runtime .InteropService s.ComUnregister Function()>
_
AxUnregister(By Val regkey As String)
Dim foo As New Control1()
ActiveXUnregist er(foo.GetType)
End Sub
------------------------------------------------------------------
That's the only extra piece of code that you have to write today, and
I wouldn't be surprised if it moved into the base class in some future
version.
now i did it... and it wouldn't work. first it was giving me a compile
time error saying identifier expected. so i moved the attribute tags
before public like this...
------------------------------------------------------------------
<System.Runtime .InteropService s.ComRegisterFu nction()> _
Public Shared Sub AxRegister(ByVa l regKey As String)
Dim foo As New QueryControl()
ActiveXRegister (foo.GetType)
End Sub
<System.Runtime .InteropService s.ComUnregister Function()> _
Public Shared Sub AxUnregister(By Val regkey As String)
Dim foo As New QueryControl()
ActiveXUnregist er(foo.GetType)
End Sub
-------------------------------------------------------------------
now the identifier expected error went away... but new errors popped
up...
Name 'ActiveXRegiste r' is not declared.
Name 'ActiveXUnregis ter' is not declared.
now what is that supposed to mean...it is not able to identify the
methods activexRegister and activexunregist er for some reason... am i
missing something...?
regards,
Nilotpal