For ST TNG and DS9 window shots they used a black, probably velvet, curtain with broken safety glass sewn/glued/held on with gum when the lights hit it and the curtain was moved, they twinkled, on those shows they probably used CG "screensavers" for the exterior shots.
You might want to look in the archives if you can since this has been asked in one form or another a few times
later
TOm
------------------
What everyone seems to forget is that once we look past race, religion, gender, and all that, everyone on this planet is first and foremost...
...a PERSON
All times are ET (US)