Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems in hiding a maximized window

Status
Not open for further replies.
Sep 20, 2010
1
0
0
IT
Hi,

I need to have a document window visible but not showing to the user. This behaviour is needed to overcome some strange Word behaviour when the document window is not visible.

I used a code (VB 6) similar to this to show the window outside the screen:

Private Sub Command1_Click()


' Initialization
Dim a As Word.Application
Set a = New Word.Application

Dim doc As Word.Document
Set doc = a.Documents.Add(, , , False)

' When ShowWindowsInTaskbar = true
' and Word has been closed with the Windowstate = wdWindowStateMaximize,
' this code flashes the document window on the screen
doc.Activate
doc.ActiveWindow.WindowState = wdWindowStateNormal
doc.ActiveWindow.Top = -doc.ActiveWindow.Height - 100
doc.ActiveWindow.Visible = True



' Clean up code:
' wait a little bit, then close.
Dim ts As Double

ts = Timer

Do While ts + 3 > Timer
Loop

doc.ActiveWindow.Top = 0
a.Quit False


End Sub

what happens is that when Word starts maximized (i.e. has been closed maximized) and the show windows in taskbar option is set to true, the document window flashes on the screen.

Any suggestion to work around this unwanted behaviour?

thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top