Removable devices, such as usb devices, flashmedia card, can only be safely removed by clicking the icon in system tray in WinXP. But how to make it programmatically?

I tried IOCTL_STORAGE_EJECT_MEDIA, FSCTL_DISMOUNT_VOLUME, but only have effect in several special cases.

Any advice be appreciated!