com本地服务器 [英] com local server

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

问题描述


我有一个com本地服务器(一个BitManipulater.exe服务器)和一个客户端.我以调试模式执行了两个客户端程序实例.如果我在Windows XP中打开任务管理器,则进程选项卡仅显示一个BitManipulater.exe进程.如果很多客户端使用同一台本地服务器,com如何处理本地服务器.我认为将有两个BitManipulater.exe实例.对此请进行任何解释,

预先感谢,
venkatanarayana

Hi,
I have a com local server(an BitManipulater.exe server) and a client.I executed two instances of client programs in debug mode.If i open the task manager in windows xp, the processes tab is showing only one BitManipulater.exe process.How com deals with local server, if lot of client are using same local server.I thought there will be two instances of BitManipulater.exe.Any explanation on this please,

Thanks in advance,
venkatanarayana

推荐答案

它可以以任何一种方式工作.服务器可以通过在调用 ^ ]函数.使用REGCLS_SINGLEUSE(请参阅 REGCLS [ ^ ])在多个实例中,而REGCLS_MULTIPLEUSE导致同一实例被重用.

如果您使用的是MFC,请查看服务器InitInstance函数中的代码.您会发现一些类似这样的内容:
It can work either way. The server can control whether a single instance or multiple instances are used by setting flags when it calls the CoRegisterClassObject[^] function. Using REGCLS_SINGLEUSE (see REGCLS[^]) will results in multiple instances while REGCLS_MULTIPLEUSE result in the same instance being reused.

If you''re using MFC look at the code in the server''s InitInstance function. You''ll find some which looks like this:
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
	IDR_MFCEXETYPE,
	RUNTIME_CLASS(CMFCExeComServerDoc),
	RUNTIME_CLASS(CChildFrame), // custom MDI child frame
	RUNTIME_CLASS(CMFCExeComServerView));
AddDocTemplate(pDocTemplate);

// Connect the COleTemplateServer to the document template.
//  The COleTemplateServer creates new documents on behalf
//  of requesting OLE containers by using information
//  specified in the document template.
m_server.ConnectTemplate(clsid, pDocTemplate, FALSE);



将带下划线的位更改为TRUE,将使用单独的实例.



Change the underlined bit to TRUE and separate instances will be used.


vasuvasanth写道:
vasuvasanth wrote:

I以为会有BitManipulater.exe的两个实例

I thought there will be two instances of BitManipulater.exe


你为什么这样想?对于进程外服务器,此行为(一个实例)看起来很适合我.
:)


Why did you think so? For an out-of-process server this behaviour (one instance) looks appropriate to me.
:)


这篇关于com本地服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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