How can I create, without a verbatim environment, these nice boxes that the Fancyvrb package produces:

The sibling package Fancybox (by the same author) doesn't allow for the caption being placed onto the box's sides.
How can I create, without a verbatim environment, these nice boxes that the Fancyvrb package produces:

The sibling package Fancybox (by the same author) doesn't allow for the caption being placed onto the box's sides.
Using @GonzaloMedina's code (here), and @egreg's suggestion, the desired code is the following:
\documentclass{article}
\usepackage{mdframed}
\usepackage{lipsum}
\newenvironment{myenv}[1]
{\mdfsetup{
frametitle={\colorbox{white}{\space#1\space}},
innertopmargin=0pt,
frametitleaboveskip=-\ht\strutbox,
frametitlealignment=\center
}
\begin{mdframed}%
}
{\end{mdframed}}
\begin{document}
\begin{myenv}{The frame title}
\lipsum[2]
\end{myenv}
\end{document}
It produces the following PDF (cropped here):

mdframed– egreg Oct 10 '12 at 15:46-\ht\strutboxparameter mean? – NVaughan Oct 10 '12 at 19:43\strutboxis an\hboxcontaining rule with0width whose height and depth add up to the\normalbaselineskipin use;\ht\strutboxis the height of the\strutbox; settingframetitleaboveskip=-\ht\strutboxraises the title by an amount equal to the height of the\strutbox. – Gonzalo Medina Oct 10 '12 at 20:41