Click here to Skip to main content
15,881,852 members
Articles / Programming Languages / VBScript

ProSysLib: Dissecting the Process

Rate me:
Please Sign up or sign in to vote.
4.84/5 (69 votes)
22 Nov 2010CPOL12 min read 128K   2.6K   174  
Access detailed information about the current process the easiest way.
/////////////////////////////////////////////////////////
// File PSLDeploy.h simplifies deployment of ProSysLib;
//
// Important:
//
// It does not use Windows Registry, i.e. the component
// does not need to be registered on the end-user PC.
/////////////////////////////////////////////////////////

#ifndef PSL_Deploy

#ifndef PSL_FILE
	#error "You must define PSL_FILE before including this file."
#endif

// Importing the type library...
#import PSL_FILE named_guids

class CPSLDeploy
{
	typedef ProSysLib::IPSLSystem * (WINAPI * CreatePSLSystemProc)();

public:

	CPSLDeploy()
	{
		m_hPSLModule = NULL;
		m_CreatePSLSystem = NULL;
	}

	bool Initialize(LPCTSTR sPSLFilePath)
	{
		if(m_hPSLModule)
			return false; // Must not call more than once;

		m_hPSLModule = ::LoadLibrary(sPSLFilePath);
		if(m_hPSLModule)
			m_CreatePSLSystem = (CreatePSLSystemProc)::GetProcAddress(m_hPSLModule, "CreatePSLSystem");

		return m_CreatePSLSystem != NULL;
	}

	virtual ~CPSLDeploy()
	{
		if(m_hPSLModule)
			::FreeLibrary(m_hPSLModule);
	}

	ProSysLib::IPSLSystem * CreateInstance()
	{
		if(m_CreatePSLSystem)
			return m_CreatePSLSystem();
		return NULL;
	}

private:

	HMODULE m_hPSLModule;
	CreatePSLSystemProc m_CreatePSLSystem;
};

#endif

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Sibedge IT
Ireland Ireland
My online CV: cv.vitalytomilov.com

Comments and Discussions