Through TxViewersManager Class there is a GetActiveViewer Method. Give it a whirl.
TxViewerControl activeViewer = TxApplication.ViewersManager.GetActiveViewer();
What do you mean by form - maybe an example? When I hear form I am thinking that it is a custom TxForm that is designed by you, so it should be pretty easy to deterimine whether it is active. If this is what you mean, there is a Focused property for windows controls.