>>964のやりたい処理はこれでOKなハズ
サンプルソース書いたよ
http://www.dotup.org/uploda/www.dotup.org13651.cpp.html