Well, you would need to tell the dialog about the document. You could add a CDocument* member variable to the dialog and set it before you call DoModal. Alternatively (and I prefer this one), just pass the relevant attributes of the document to the dialog, so the dialog doesn't need to know about the document - letting the dialog have visibility of the document class upsets my aesthetic sense.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p