小编Exc*_*l20的帖子

无法创建PowerPoint的多个实例

我正在开发一个需要使用C#.net的PowerPoint的项目.最初,我总是创建一个单独的实例.截至今天,我想要运行多个实例.我这样做:

Type powerpointType = Type.GetTypeFromProgID("PowerPoint.Application");

object instance1 = Activator.CreateInstance(powerpointType);
object instance2 = Activator.CreateInstance(powerpointType);
Run Code Online (Sandbox Code Playgroud)

但是当我要求两个实例的句柄时,通过调用

hwnd = (int)powerpointType.GetProperty("HWND").GetValue(instance1, null);
Run Code Online (Sandbox Code Playgroud)

然后我得到两次相同的手柄.我的结论是应用程序只启动一次,而TaskManager确认:只有一个进程.

为什么只有一个PowerPoint运行实例,我怎样才能使它运行?

c# powerpoint

5
推荐指数
1
解决办法
1990
查看次数

标签 统计

c# ×1

powerpoint ×1