SilverScreen Solid Modeler

Creating a DLL skeleton

Creating a DLL skeleton

Previous topic Next topic  

Creating a DLL skeleton

Previous topic Next topic JavaScript is required for the print function  

SilverPlusEllipse

 

Creating a DLL skeleton

 


The following procedure for Visual Studio may be used to build a DLL that may be used by a SilverC program.

 

r_point

Use the file menu to create a new project.

r_point

From New Project Workspace dialog, choose to create an  "MFC DLL",  give the project a name, and select a directory (preferably empty) to put it in. In this case, the project is titled "SilverDLL"

r_point

From the MFC AppWizard dialog, select "regular DLL using shared MFC DLL", and choose any other options (OLE Automation, Windows Sockets, Add comments). The new project will be created.

r_point

Edit the main file in your skeleton project: it will have the same name as your project, with the extension ".cpp". The file will contain the code to declare and initialize an object derived from the MFC CWinApp class, its name derived from the name of your project, such as SilverDLLApp. If you wish to add code that executes when the DLL loads or exits, you may override the class functions InitInstance and ExitInstance, respectively.

 

 

 


The following code demonstrates a typical starting point for an MFC DLL:

 

C / C++ Code

 

 #include "stdafx.h"

 #include "mfdll.h"

 

 

 CSilverDLLApp theApp;          // The one and only CSilverDLLApp object

 HINSTANCE     mfdll_instance = NULL;

 

 

 ///////////////////////////////////////////////////////////////////

 // CSilverDLLApp message map

 

 BEGIN_MESSAGE_MAP(CSilverDLLApp, CWinApp)

    .

    .

    .

 END_MESSAGE_MAP()

 

 

 ///////////////////////////////////////////////////////////////////

 // CSilverDLLApp construction

 

 CSilverDLLApp::CSilverDLLApp()

 {

 }

 

 

 BOOL CSilverDLLApp::InitInstance()

 {

 mfdll_instance = m_hInstance;

 return CWinApp::InitInstance();

 }

 

 

 

 int CSilverDLLApp::ExitInstance()

 {

 return CWinApp::ExitInstance();

 }

 

 

 

 // return a pointer to the DLL's CWinApp

 

 CWinApp *GetTheApp()

 {

 return (CWinApp *) &theApp;

 }