> Every now and then, I get a flash of a small Word window that looks
> like it's left over from running a macro program (in the program, I
> deliberately set the Word window to about 3 inches square and parked
> it off to the side). Is there a way to get a Word macro to show me
> every instance of Word, even if not visible?
Sure. Will take a bit of hand-tuning, but the basic idea would be to:
*** call EnumWindows,
http://vb.mvps.org/samples/FindPart
*** watch for those with a classname of "OpusApp",
Private Declare Function GetClassname Lib "user32" Alias "GetClassNameA" (ByVal
hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Function Classname(ByVal hWnd As Long) As String
Dim nRet As Long
Dim Class As String
Const MaxLen As Long = 256
' Retrieve classname of passed window.
Class = String$(MaxLen, 0)
nRet = GetClassname(hWnd, Class, MaxLen)
If nRet Then Classname = Left$(Class, nRet)
End Function
*** call ShowWindow to make visible.
Private Declare Function IsWindowVisible Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal
nCmdShow As Long) As Long
Private Const SW_HIDE = 0
Private Const SW_SHOW = 5
Public Function WindowVisible(ByVal hWnd As Long, Optional NewValue) As Boolean
' Attempt to affirm, if user specified a new setting.
If Not IsMissing(NewValue) Then
If CBool(NewValue) Then
Call ShowWindow(hWnd, SW_SHOW)
Else
Call ShowWindow(hWnd, SW_HIDE)
End If
End If
' Return current visibility.
WindowVisible = IsWindowVisible(hWnd)
End Function
> As a side question, would it be possible for this instance of Word to
> get "caught" somewhere, and persist or reopen after Restarts and Shut
> Downs? I am using Word 2000 and Windows 2000.
Sounds unlikely to the point of impossible, no.
--
Working Without a .NET?
http://classicvb.org/petition
Ed - 09 Nov 2005 20:49 GMT
I take it this would be better off in a VB6 app than a Word macro?
> > Every now and then, I get a flash of a small Word window that looks
> > like it's left over from running a macro program (in the program, I
[quoted text clipped - 54 lines]
> Working Without a .NET?
> http://classicvb.org/petition
Karl E. Peterson - 09 Nov 2005 21:37 GMT
> I take it this would be better off in a VB6 app than a Word macro?
No, not at all. Would work just fine, in either place.
--
Working Without a .NET?
http://classicvb.org/petition
>>> Every now and then, I get a flash of a small Word window that looks
>>> like it's left over from running a macro program (in the program, I
[quoted text clipped - 56 lines]
>> Working Without a .NET?
>> http://classicvb.org/petition
Ed - 09 Nov 2005 21:41 GMT
Thanks, Karl. I'll have to work with this a bit to make sure I've got it
right.
Ed
> > I take it this would be better off in a VB6 app than a Word macro?
>
[quoted text clipped - 63 lines]
> >> Working Without a .NET?
> >> http://classicvb.org/petition