470,586 Members | 1,275 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,586 developers. It's quick & easy.

windows control library with activex...

don
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
Jul 19 '05 #1
0 2639

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by andy.g.ward | last post: by
2 posts views Thread by Miky | last post: by
13 posts views Thread by Lee Newson | last post: by
7 posts views Thread by Jarod_24 | last post: by
2 posts views Thread by Iwan Budihalim | last post: by
2 posts views Thread by =?Utf-8?B?Sm9obiBG?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.