Hmm, I never tried getting the ID of a window, but these API's might do the trick...

Try GetWindow, GetWindow[...], EnumWindows or search on the web... there must be a way to retrieve the ID.