Yes, if a program terminates, Windows automatically frees all the resources it gave it while it was running. Still, it's better to free a resource during runtime if you're not going to use it anymore. It will save you from possible memory leaks and perhaps a longer wait for the program to terminate.
That said, it's no big deal if it's just references here and there... but if you're creating a ton of types in a loop or something that you only use once each, well, that's another issue.
And for your second question, you can use the WinAPI function GetWindowPlacement to determine whether your window is minimized or not. An example follows. Move the window around and min/max it and see what happens. You'll notice that ShowCmd is 2 when the window is minimized.
; .lib "user32.dll"
; GetWindowPlacement%(hwnd%, pwpl*):"GetWindowPlacement"
CreateTimer(1)
w = CreateWindow("WindowPlacement Test", 100, 100, 400, 400, 0, 3)
Repeat
Select WaitEvent()
Case $803 : End
Case $4001 : wp(QueryObject(w,1))
End Select
Forever
Function wp(hwnd)
wp.WindowPlacement = New WindowPlacement
wp\size = 11 * 4
If Not GetWindowPlacement(hwnd, wp) Then
Notify "Failed"
Else
Print "Flags: " + wp\flags
Print "ShowCmd: " + wp\showCmd
Print "MinPos: ("+wp\x_MinPos+","+wp\y_MinPos+")"
Print "MaxPos: ("+wp\x_MaxPos+","+wp\y_MaxPos+")"
Print "Rect: ("+wp\leftRect+","+wp\topRect+") - ("+wp\rightRect+","+wp\bottomRect+")"
Print "-----------"
EndIf
End Function
Type WindowPlacement
Field size
Field flags
Field showCmd
Field x_MinPos, y_MinPos
Field x_MaxPos, y_MaxPos
Field leftRect, topRect, rightRect, bottomRect
End Type