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.ActiveXRegister and Control.ActiveXUnregister.
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 ActiveXUnregister.
------------------------------------------------------------------
.NET Registration as an ActiveX Control
Public Shared Sub <System.Runtime.InteropServices.ComRegisterFunctio n()>
_
AxRegister(ByVal regKey As String)
Dim foo As New Control1()
ActiveXRegister(foo.GetType)
End Sub
Public Shared Sub <System.Runtime.InteropServices.ComUnregisterFunct ion()>
_
AxUnregister(ByVal regkey As String)
Dim foo As New Control1()
ActiveXUnregister(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.InteropServices.ComRegisterFunctio n()> _
Public Shared Sub AxRegister(ByVal regKey As String)
Dim foo As New QueryControl()
ActiveXRegister(foo.GetType)
End Sub
<System.Runtime.InteropServices.ComUnregisterFunct ion()> _
Public Shared Sub AxUnregister(ByVal regkey As String)
Dim foo As New QueryControl()
ActiveXUnregister(foo.GetType)
End Sub
-------------------------------------------------------------------
now the identifier expected error went away... but new errors popped
up...
Name 'ActiveXRegister' is not declared.
Name 'ActiveXUnregister' is not declared.
now what is that supposed to mean...it is not able to identify the
methods activexRegister and activexunregister for some reason... am i
missing something...?
regards,
Nilotpal