pullingteeth
Programmer
Hello, I had a vba script which switched windows between two applications. The code below used to work in Windows 95, but doesn't in Windows XP. I determined using the debugger that it is the closewindow statement which doesn't work. Any idea what's going on here? Thanks
Code:
dim ntsid as long
dim winid as long
dim y as long
' get the NTS id
ntsid = GetForegroundWindow
y = CloseWindow(ntsid)
OpenDatabase:dim ntsid as long
dim winid as long
dim y as long
' get the NTS id
ntsid = GetForegroundWindow
y = CloseWindow(ntsid)
' find the tracking window
y = FindWindow("", "Tracking")
' minimize all windows until we find the tracking window
winid = getForegroundWindow
if x = 0 then ' this means that the tracking database is not present
msgbox " WAIT!! Please verify the Concord Database is open and that you've signed on. Rerun the macro."
goto EndAndLetThemFigureItOut
else
y = ShowWindow(x, 3)
y = ShowWindow(x, 5)
while (not (winid = x))
y = CloseWindow(winid)
winid = getForegroundWindow
wend
end if
' find the tracking window
y = FindWindow("", "Tracking")
' minimize all windows until we find the tracking window
winid = getForegroundWindow
if x = 0 then ' this means that the tracking window is not present
msgbox " (error)"
goto EndAndLetThemFigureItOut
else
y = ShowWindow(x, 3)
y = ShowWindow(x, 5)
while (not (winid = x))
y = CloseWindow(winid)
winid = getForegroundWindow
wend
end if