运行对象表中的多个 Word2007 引用

发布于 2024-09-06 10:32:39 字数 435 浏览 7 评论 0原文

与早期版本相反(请参阅此处),我发现 Word2007 在运行对象中放置了一个条目正在运行的每个 WinWord.exe 实例的表。 (使用 MS VC 6.0 附带的 IROTVIEW.exe!)
我正在尝试构建一个自动执行 Word 的应用程序,并且希望用户无法使用隐藏的 Word 实例,同时与单独的可见实例共存。是否有任何方法可以阻止 Word 在 ROT 中注册自身,或者确保当用户双击 Word 文档时,打开该文档的是可见实例?

经过反思,也许我应该问一个不同的问题:当广播 DDE 消息并且有多个具有正确应用程序名称的窗口时,什么决定哪个窗口首先处理该消息?我问这个问题是因为我意识到 doc、docx 扩展名等的文件关联表明将使用 DDE 打开该文档。

Contrary to earlier versions (see here), I find that Word2007 places one entry into the Running Object Table for each instance of WinWord.exe that is running. (Using IROTVIEW.exe supplied with MS VC 6.0!)
I am trying to build an application that automates Word, and I would like to keep a hidden instance of Word unavailable to the user, while co-existing with a separate visible instance. Is there any way of preventing Word from registering itself in the ROT, or alternatively of ensuring that when the user double-clicks on a Word document, it is the visible instance that opens the document?

On reflection perhaps I should be asking a different question: when broadcasting a DDE message and there are multiple windows with the correct Application name, what determines which window gets to process the message first? I ask because I realise that the File Association for doc, docx extensions etc indicates that DDE will be used to open the document.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

像你 2024-09-13 10:32:39

也许我不明白这个问题,但出于所有实际目的,隐藏了一个不可见的实例。用户将无法打开该实例或与其关联的任何文档。

Public Sub Test()
    Dim currentDocument As Document

    Dim i As Long
    For i = 1 To 3
        Dim newApplication As Word.Application
        Set newApplication = CreateObject("Word.Application")
        Set currentDocument = newApplication.Documents.Add
        currentDocument.Range.InsertAfter "New instance " & i

        If i = 2 Then
            currentDocument.Windows(1).Visible = False
        Else
            currentDocument.Windows(1).Visible = True
        End If
    Next
End Sub

Maybe I don't understand the question but a non visible instance is hidden for all practical purposes. The user won't be able to open that instance or any documents associated with it.

Public Sub Test()
    Dim currentDocument As Document

    Dim i As Long
    For i = 1 To 3
        Dim newApplication As Word.Application
        Set newApplication = CreateObject("Word.Application")
        Set currentDocument = newApplication.Documents.Add
        currentDocument.Range.InsertAfter "New instance " & i

        If i = 2 Then
            currentDocument.Windows(1).Visible = False
        Else
            currentDocument.Windows(1).Visible = True
        End If
    Next
End Sub
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文