USB detach problem



Hello.

I am developing device with 2 interfaces. 1st is HID keyboard and 2nd
is HID generic.
It is self-powered and there is no problem when USB connector is
disconnected but both devices are not detached when DC adaptor is
removed.
Even function that finds device shows that device is connected and
device still remains in device manager.
And when I choose refresh menu in device manager, device disappears.
As far as I know I have designated device as self-powered and I have
no idea why this problem happens.

Please help me solve this problem.
Thanks.
.