Ok, I am trying to monitor other windows and when a specific Outlook window closes (based on Window Title), I want the form I am in to close automatically as well.
The problem I am having it that for some reason the window stays in the list, even after the window is closed. My code is below, I have hard coded the “Test Window” into my code for example, but that is a variable, as is h. Anyone see what I might be doing wrong that would cause the window list to never be refreshed? Also, this code is in the Action event of a timer control that has period set to 100.
dim subj as text = "Test Window"
dim h as integer = 100
if subj <> "" then
if h > 0 then
dim w as new WindowsListMBS
dim i,c as integer
dim s(-1) as string
c=w.WindowCount-1
for i=0 to c
if w.WindowText(i).Contains(subj) then
exit sub
end if
next i
PHWork.Close
end if
end if