Where is the HDC handle coming from?

The HDC must be obtained with GetDC() from the CWnd (window class).

In the OnPaint( HDC ) function ( AnnoUIOnPaint(lAnno, hDC) ) the background must be drawn before calling the annotation DLL. See the sample source below:

 

void CVtiffView::OnPaint()

{

    CPaintDC dc(this);                                                             // device context for painting

    DisplayDIBImageDC(dc.m_hDC, &pDoc->sDisplay);     // displaying the background

    MapDisplayDC(dc.m_hDC, &pDoc->sDisplay);               // for proper mapping

    AnnoUIOnPaint( lAnno, dc.m_hDC );                               // drawing annotation objects

}