Probably SetWindowLong(GWL_HWNDPARENT) should not do a full SetParent, but just set the window owner. Looks like this needs more testing under Windows to find out exactly what it's supposed to do.
Interestingly I took out that SetParent call as a hack to get beyond bug#825 which is exactly what VB is doing for 'modal' windows (setting GWL_HWNDPARENT) which basically means modal windows become unusable.
Jason