In my program, I would like to have a list with all the open programs/windows on my pc. How do I do that???

Also, how can u close running programs or windows using the list that has all the window names.