创建OCX文件 [英] Creating OCX files

查看:56
本文介绍了创建OCX文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能指出我在VB .net中创建OCX控件的入门知识吗?特别是,我想访问VB6应用程序中的Web服务(这不是一件容易的事)。所以,如果我可以编写一个在.Net中完成此操作的ActiveX控件,那么我应该能够将OCX组件添加到我的VB6应用程序并使用它。除非有人知道为什么这不起作用....


感谢任何和所有的帮助。

Can anyone point me to a primer for creating OCX controls in VB .net? In particular, I want to access a web service in a VB6 application (not an easy thing to do). So, if I can write an ActiveX control that accomplishes this in .Net, then I SHOULD be able to add the OCX component to my VB6 app and use it. Unless someone knows why this wouldn''t work....

Any and all help is appreciated.

推荐答案

2004年5月3日星期一15:46:02 -0700,Steve < ST *********** @ ci.slc.ut.us>写道:

$ b $b¤有人能指点我在VB .net中创建OCX控件的入门书吗?特别是,我想访问VB6应用程序中的Web服务(这不是一件容易的事)。所以,如果我可以编写一个在.Net中完成此操作的ActiveX控件,那么我应该能够将OCX组件添加到我的VB6应用程序并使用它。除非有人知道为什么这不起作用.....
$ b $b¤
$ b $b¤感谢任何和所有的帮助。


您无法使用.NET创建COM组件。您必须使用SOAP工具包和VB 6.0来访问Web服务:

http://msdn.microsoft.com/library/de...oapwebserv.asp

Paul ~~~ pc ****** @ ameritech.net

Microsoft MVP(Visual Basic)
On Mon, 3 May 2004 15:46:02 -0700, "Steve" <st***********@ci.slc.ut.us> wrote:

¤ Can anyone point me to a primer for creating OCX controls in VB .net? In particular, I want to access a web service in a VB6 application (not an easy thing to do). So, if I can write an ActiveX control that accomplishes this in .Net, then I SHOULD be able to add the OCX component to my VB6 app and use it. Unless someone knows why this wouldn''t work.....
¤
¤ Any and all help is appreciated.

You cannot create COM components with .NET. You have to use the SOAP toolkit with VB 6.0 to access
the web service:

http://msdn.microsoft.com/library/de...oapwebserv.asp
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)





" Paul Clement"写道:
Hi,

"Paul Clement" wrote:
你不能用.NET创建COM组件


这不是真的。您可以使用.Net创建COM组件。 CCW(COM Callable

Wrapper)由.Net提供给COM互操作。请参阅:
http://msdn.microsoft.com/library/en...asp?frame=true

COM客户端不了解.Net(如VB6)的主要互操作问题是

他们没有调用CorExitProcess(由MSCOREE.dll导出)。那个顺序

意味着CLR没有正确终止,其他问题意味着终结者不会在非托管进程终止时运行。最后是

,因为没有调用CorExitProcess,CLR只会被通知说明

进程正在关闭DllMain的进程分离通知。此时

加载程序锁定,因此无法完成代码

可以安全运行。

但是,如果可以的话使用out-proc COM调用 - 实现你的.Net

对象作为System.EnterpriseServices.ServicedComponent的后代,并且

注册它以在COM + Server Application中运行 - 其余的是像往常一样和

COM +服务会关注CLR的正确终止。


然而,在最初的问题中,作者问的是OCXs ......

使用.Net实现OLE控件(实际上是OCX)很多,但是仍然可行,只需要你实现所有必要的

.Net对象上的OLE接口。在那之后 - 应该可以使用你的.Net对象作为OCX ...但是OLE控件容器的问题不是

调用CorExitProcess仍然存在。


-Valery。

http:/ /www.harper.no/valery


" Paul Clement" < US ******** @ swspectrum.com>在消息中写道

news:fa ******************************** @ 4ax.com ... 2004年5月3日星期一15:46:02 -0700,史蒂夫 < st *********** @ ci.slc.ut.us>
写道:

¤任何人都可以给我一个创建OCX控件的入门书VB .net?
特别是,我想在VB6应用程序中访问Web服务(不是一件容易的事情)。所以,如果我可以编写一个在.Net中完成此操作的ActiveX控件,那么我应该能够将OCX组件添加到我的VB6应用程序中并使用它。除非有人知道为什么这不会起作用.....
¤
¤感谢所有的帮助。

你无法创建COM组件。净。您必须使用SOAP
工具包与VB 6.0访问Web服务:

http://msdn.microsoft.com/library/de...oapwebserv.asp

Paul ~~~ pc ****** @ ameritech.net
Microsoft MVP(Visual Basic)
You cannot create COM components with .NET
This is not true. You can create COM components with .Net. CCW (COM Callable
Wrapper) is provided by .Net for COM interop. See:
http://msdn.microsoft.com/library/en...asp?frame=true.
Main interop problem with COM clients not aware about .Net (like VB6) is
that they don''t call CorExitProcess (exported by MSCOREE.dll). That in order
means that CLR doesn''t terminate properly and among other problems means
that Finalizers will not be run on unmanaged proccess terminate. Last is
because without a call to CorExitProcess, the CLR is only notified that the
process is shutting down from DllMain''s process detach notification. The
loader lock is held at this point, so there is no way that finalization code
can safely run.
However, if you can live with out-proc COM calls - implement your .Net
object as descendant of System.EnterpriseServices.ServicedComponent and
register it to run in COM+ Server Application - the rest is as usual and
COM+ services would take care about correct termiation of CLR.

However, in the original question author is asking about OCXs...
To implement OLE control (which is OCXs really are) with .Net is much
trickier, but still doable and only requires you implementing all necessary
OLE interfaces on your .Net object. After that - it should be possible to
use you .Net object as OCX... but problem of OLE control container not
calling CorExitProcess still remains.

-Valery.

http://www.harper.no/valery

"Paul Clement" <Us***********************@swspectrum.com> wrote in message
news:fa********************************@4ax.com... On Mon, 3 May 2004 15:46:02 -0700, "Steve" <st***********@ci.slc.ut.us>
wrote:

¤ Can anyone point me to a primer for creating OCX controls in VB .net?
In particular, I want to access a web service in a VB6 application (not an
easy thing to do). So, if I can write an ActiveX control that
accomplishes this in .Net, then I SHOULD be able to add the OCX component
to my VB6 app and use it. Unless someone knows why this wouldn''t
work.....
¤
¤ Any and all help is appreciated.

You cannot create COM components with .NET. You have to use the SOAP
toolkit with VB 6.0 to access
the web service:

http://msdn.microsoft.com/library/de...oapwebserv.asp
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)



2004年5月4日星期二18:19:45 +0200,Valery Pryamikov < Va的**** @ nospam.harper.no>写道:

$ b $b¤
$ b $b¤
$ b $b¤" Paul Clement"写道:
$ b $b¤>你不能用.NET创建COM组件
$ b $b¤
$ b $b¤这不是真的。您可以使用.Net创建COM组件。 CCW(COM Callable
$ b $b¤Wrapper)由.Net提供给COM互操作。请参阅:
$ b $b¤ http://msdn.microsoft.com/library/en...asp?frame=true


COM可调用包装器不是COM组件。它是COM和.NET托管代码之间的接口通信(或互操作)层。

$ b $b¤与COM客户端不了解.Net的主要互操作问题(比如VB6)
$ b $b¤他们不会调用CorExitProcess(由MSCOREE.dll导出)。按顺序
$ b $b¤意味着CLR没有正确终止,其他问题意味着终结者不会在非托管进程终止时运行。$ b $b¤最后是
$ b $b¤因为没有调用CorExitProcess,CLR只会被告知
$ b $b¤进程正在关闭DllMain的进程分离通知。此时
$ b $b¤装载机锁定,因此无法确定最终代码
$ b $b¤是否可以安全运行。
$ b $b¤但是,如果您可以使用out-proc COM调用 - 实现您的.Net
$ b $b¤对象作为System.EnterpriseServices.ServicedComponent的后代,并且
$ b $b¤将其注册为在COM + Server中运行申请 - 其余部分和往常一样
$ b $b¤COM+服务会关注CLR的正确终止。
$ b $b¤
$ b $b¤但是,在最初的问题作者询问OCXs ...
$ b $b¤用.Net来实现OLE控件(这是OCXs真的很多)很多,但是仍然可行,但仍然可行只需要在.Net对象上实现所有必需的
$ b $b¤OLE接口。在那之后 - 应该可以使用你的.Net对象作为OCX ...但是OLE控件容器的问题不是
$ b $b¤调用CorExitProcess仍然存在。 /> $ b $b¤


实际上他想在VB.NET中创建一个可以在VB 6.0中使用的OCX控件。你不能在.NET中创建(COM)OCX控件,所以这是不可能的。

保罗~~~ pc ****** @ ameritech.net

Microsoft MVP(Visual Basic)
On Tue, 4 May 2004 18:19:45 +0200, "Valery Pryamikov" <Va****@nospam.harper.no> wrote:

¤ Hi,
¤
¤ "Paul Clement" wrote:
¤ > You cannot create COM components with .NET
¤
¤ This is not true. You can create COM components with .Net. CCW (COM Callable
¤ Wrapper) is provided by .Net for COM interop. See:
¤ http://msdn.microsoft.com/library/en...asp?frame=true.

A COM callable wrapper is not a COM component. It is the interface communication (or interop) layer
between COM and .NET managed code.

¤ Main interop problem with COM clients not aware about .Net (like VB6) is
¤ that they don''t call CorExitProcess (exported by MSCOREE.dll). That in order
¤ means that CLR doesn''t terminate properly and among other problems means
¤ that Finalizers will not be run on unmanaged proccess terminate. Last is
¤ because without a call to CorExitProcess, the CLR is only notified that the
¤ process is shutting down from DllMain''s process detach notification. The
¤ loader lock is held at this point, so there is no way that finalization code
¤ can safely run.
¤ However, if you can live with out-proc COM calls - implement your .Net
¤ object as descendant of System.EnterpriseServices.ServicedComponent and
¤ register it to run in COM+ Server Application - the rest is as usual and
¤ COM+ services would take care about correct termiation of CLR.
¤
¤ However, in the original question author is asking about OCXs...
¤ To implement OLE control (which is OCXs really are) with .Net is much
¤ trickier, but still doable and only requires you implementing all necessary
¤ OLE interfaces on your .Net object. After that - it should be possible to
¤ use you .Net object as OCX... but problem of OLE control container not
¤ calling CorExitProcess still remains.
¤

Well actually he wants to create an OCX control in VB.NET that he can use in VB 6.0. You can''t
create (COM) OCX controls in .NET so this isn''t possible.
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)


这篇关于创建OCX文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆