SilverScreen Solid Modeler

SilverScreen and MFC

SilverScreen and MFC

Previous topic Next topic  

SilverScreen and MFC

Previous topic Next topic JavaScript is required for the print function  

SilverPlusEllipse

 

SilverScreen and MFC

 


SilverScreen is built as an MFC document/view application, using SDI (Single Document Interface). This means that SilverScreen contains a main frame window implemented by a class derived from CFrameWnd, and a single view window derived from CView. The main frame window contains the usual assortment of user interface items, including a main menu, ribbon and status bar. The view window is where SilverScreen drawings are displayed.

 

 

 

SilverScreen's MFC Architecture

The following figure shows the general structure of SilverScreen's architecture. Note that the status bar and individual ribbons may be enabled or disabled as the user wishes.

 

MFCArchitecture

 

 

 

Getting Handles

When subclassing SilverScreen windows, the windows that we are usually interested in are the main frame window and the view window. In order to subclass them, we must have their window handles. The main frame window handle may be obtained by calling the MFC function AfxGetMainWnd() to obtain a CFrameWnd pointer, and then calling the CFrameWnd's member function GetSafeHwnd(). The return value is the main frame window handle. The view window handle may be obtained by calling the CFrameWnd member function GetActiveView() to obtain a CView pointer, and then calling its GetSafeHwnd() member function. The following piece of code demonstrates the technique.

 

C / C++ Code

 

void GetFrameAndViewWindowHandles()

{

CFrameWnd *mf;

CView     *v;

HWND      frame_handle = 0;

HWND      view_handle  = 0;

 

if ( mf = (CFrameWnd *) AfxGetMainWnd() )

   {

   frame_handle = mf->GetSafeHwnd();

 

   if ( v = mf->GetActiveView() )

      view_handle = v->GetSafeHwnd();

   }

}

 

 

 

 

 

See Also

For a complete example of how to subclass the view and mainframe window, see the SilverPlus sample application MFDLL.