\def\StartHide{\doifmode{hideSolution}{\starteffect[hidden]}}
\def\StopHide{\doifmode{hideSolution}{\stopeffect\blank[\the\noflines*line + \the\noflines*halfline]}}
\enablemode[hideSolution]
\starttext
The first line.
\hrule
\StartHide
\samplefile{knuth}
\determinenoflines{\samplefile{knuth}}
\StopHide
\hrule
The second line.
\hrule
\StartHide
\samplefile{ward}
\determinenoflines{\samplefile{ward}}
\StopHide
\hrule
The last line.
\stoptext