>> SetWindowLong(Wnd, GWL_USERDATA, Integer(BaseWindow)); > > Not 64-bits safe. An integer is not a long. Ptruint probably. Ah well, there is a new API to fix this in 64 bit Windows. Use SetWindowLongPtr/GetWindowLongPtr instead.