How can I avoid that the print setup dialog appears? I want the user to print directly.

You should set CPrintInfo::m_bDirect = TRUE (for example in OnPreparePrinting).