Click here to Skip to main content
15,891,253 members
Articles / Desktop Programming / MFC

SolidGraph CAD System

Rate me:
Please Sign up or sign in to vote.
4.97/5 (78 votes)
12 Sep 20062 min read 375.5K   29.8K   209  
A SolidGraph CAD system source code.
// SplashLib.cpp : Defines the initialization routines for the DLL.
//

#include "stdafx.h"
#include <afxdllx.h>

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

static AFX_EXTENSION_MODULE SplashLibDLL = { NULL, NULL };

class DllInstanceSwitcher
{
public:
	DllInstanceSwitcher()
	{
		m_hInst = AfxGetResourceHandle();
		AfxSetResourceHandle(SplashLibDLL.hResource);
	}
	~DllInstanceSwitcher()
	{
		AfxSetResourceHandle(m_hInst);
	}
private:
	HINSTANCE m_hInst;
};

#define SWITCH_RESOURCE  DllInstanceSwitcher __SwitchInstance;




extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	// Remove this if you use lpReserved
	UNREFERENCED_PARAMETER(lpReserved);

	if (dwReason == DLL_PROCESS_ATTACH)
	{
		TRACE0("SplashLib.DLL Initializing!\n");
		
		// Extension DLL one-time initialization
		if (!AfxInitExtensionModule(SplashLibDLL, hInstance))
			return 0;

		new CDynLinkLibrary(SplashLibDLL);

	}
	else if (dwReason == DLL_PROCESS_DETACH)
	{
		TRACE0("SplashLib.DLL Terminating!\n");

		// Terminate the library before destructors are called
		AfxTermExtensionModule(SplashLibDLL);
	}
	return 1;   // ok
}

#include "SplashClass.h"

static CSplashClass* global_Splash = NULL;
extern "C" AFX_EXT_API void StartSplash()
{
	SWITCH_RESOURCE
	if (global_Splash!=NULL)
		return;
	global_Splash = new CSplashClass;
}


extern "C" AFX_EXT_API void EndSplash(HWND wnd)
{
	if (global_Splash==NULL)
		return;
	if (wnd)
	{
		SetFocus(wnd);
		SetForegroundWindow(wnd);
	}
	delete global_Splash;
}


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions