Extending the “Add Media”-Dialog … how do I finally insert something to the Post?

I found out myself. I had to call

media_upload_header();

in the Iframe and trigger the following javascript:

var html="stuff I want to return to editor";
var win = window.dialogArguments || opener || parent || top;
win.send_to_editor(html);

I have no Idea how, but this works.