Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Close all windows of a particular application type

Keywords:  winclose winexename Close all windows app

Question:

I would like to close all windows of a particular application type, except one. The one I want to leave open has a constant window title called "MAIN MENU". The other windows will have varying titles, but are all launched by the same windows application executable that launches the "MAIN MENU" window. The executable controlling all these windows is C:\ORAWIN95\BIN\F45RUN32.EXE.

Is it possible to find out if any of these windows with varying titles, executed by C:\ORAWIN95\BIN\F45RUN32.EXE, are currently open (excluding the window with the constant title "MAIN MENU") and if so, display a message to the user that they must close these other windows before exiting the "MAIN MENU" window?

Whew! I hope this makes some sense because I could really use your help. If you know of a way to accomplish this I would appreciate you assistance!!! Thanks in advance.

Answer:

See the function WinExeName.....


Exe="F45RUN32.EXE"

list=WinItemize()

count=Itemcount(list,@tab)

for x = 1 to count

  title=Itemextract(x,list,@tab)

  if title == "main menu" then continue

  daExe=WinExeName(title)

  root=FileRoot(daExe)

  ext=FileExtension(daExe)

  daExe=strcat(root,".",ext)


  if strupper(daExe) == strupper(Exe)

    WinClose(title)

  endif

next

exit




Article ID:   W14756
Filename:   Close all windows of a particular application type.txt