Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Project Line Counter Add-In v2.10 for VS.NET and VC6

, 29 Jun 2003
Get statistics about your source code with a click of a button
linecount_dll.zip
linecount_src.zip
Help
arrowrt.gif
Index.hhk
LineCount.chm
LineCount.hhp
mailto.gif
metl011.gif
PLC.gif
small_exclamation.gif
TOC.hhc
weblink.gif
res
idr_main.ico
project.ico
TBarLrge.bmp
TBarMedm.bmp
title.ico
ExtrnSrc
Release
LineCount.dll
WWhizInterface.mod
LineCount.chm
plc110src.zip
plc111.zip
plc111src.zip
Source
LineCount.dsw
LineCount_VC5.dsw
LineCount.dsp
LineCount_VC5.dsp
LineCount.odl
LineCount.def
Help
.cvsignore
Index.hhk
LineCount.hhp
PLC.gif
TOC.hhc
arrowrt.gif
mailto.gif
metl011.gif
small_exclamation.gif
weblink.gif
res
TBarLrge.bmp
TBarMedm.bmp
idr_main.ico
project.ico
title.ico
ExtrnSrc
Debug
WWhizInterface2D.mod
plc150.zip
Reports
SampleAnalysis.xls
Simple-BW.xsl
Simple-Color.xsl
plc150src.zip
SampleAnalysis.xls
Simple-BW.xsl
Simple-Color.xsl
LineCount.dsw
LineCount.dsp
LineCount.odl
LineCount.def
LineCount.clw
.cvsignore
TOC.hhc
linecount.hhp
arrowrt.gif
Index.hhk
PLC.gif
mailto.gif
small_exclamation.gif
weblink.gif
info_dot_small.gif
TBarLrge.bmp
idr_main.ico
project.ico
HdrDownA.bmp
HdrUpA.bmp
title.ico
info.ico
TBarMedm.bmp
WWhizInterface2D.mod
plc200.zip
plc200src.zip
.cvsignore
LineCount.def
LineCount.dsp
LineCount.dsw
LineCount.odl
ResizableLib
.cvsignore
ResizableLib.dsp
ResizableLib.dsw
.cvsignore
Index.hhk
LineCount.hhp
PLC.gif
TOC.hhc
arrowrt.gif
info_dot_small.gif
mailto.gif
small_exclamation.gif
weblink.gif
ObjModelVC6
ObjModelVC7
MSADDNDR.tlh
MSO.tlh
dte.tlh
HdrDownA.bmp
HdrUpA.bmp
LineCountVC6.rgs
LineCountVC7.rgs
TBarLrge.bmp
TBarMedm.bmp
idr_main.ico
info.ico
lcgo.bmp
project.ico
title.ico
WWhizInterface2D.mod
plc210.zip
plc210src.zip
.cvsignore
LineCount.def
LineCount.dsp
LineCount.dsw
LineCount.odl
.cvsignore
ResizableLib.dsp
ResizableLib.dsw
.cvsignore
Index.hhk
LineCount.hhp
PLC.gif
TOC.hhc
arrowrt.gif
info_dot_small.gif
mailto.gif
small_exclamation.gif
weblink.gif
MSADDNDR.tlh
MSO.tlh
dte.tlh
HdrDownA.bmp
HdrUpA.bmp
LineCountVC6.rgs
LineCountVC7.rgs
TBarLrge.bmp
TBarMedm.bmp
gallery.xsl
idr_main.ico
info.ico
lcgo.bmp
project.ico
title.ico
WWhizInterface2D.mod
///////////////////////////////////////////////////////////////////////////////
// $Workfile: WWhizInterface2Loader.cpp $
// $Archive: /WorkspaceWhiz/Src/Shared/WWhizInterface2Loader.cpp $
// $Date:: 1/03/01 12:13a  $ $Revision:: 16   $ $Author: Jjensen $
///////////////////////////////////////////////////////////////////////////////
// This source file is part of the Workspace Whiz! source distribution and
// is Copyright 1997-2001 by Joshua C. Jensen.  (http://workspacewhiz.com/)
//
// The code presented in this file may be freely used and modified for all
// non-commercial and commercial purposes so long as due credit is given and
// this header is left intact.
///////////////////////////////////////////////////////////////////////////////
#include <afx.h>
#include "WWhizInterface2.h"
#include "WWhizInterface2Loader.h"

#define USE_WWHIZ_AICLOADER 0
#if USE_WWHIZ_AICLOADER
#include "AICLoader.h"
#include "AddInComm.h"
#endif //USE_WWHIZ_AICLOADER

class WWhizInterface;

typedef WWhizInterface* (*pfnWWhizCreate)(IApplication* pApplication);
typedef void (*pfnWWhizDestroy)();

static HINSTANCE s_wwhizInst;
static pfnWWhizCreate s_wwhizInterfaceCreate;
static pfnWWhizDestroy s_wwhizInterfaceDestroy;
static WWhizInterface* s_wwhizInterface;

// this object will automatically clean up after the loader by calling
// WWhizDestroy() when the program exists.
static struct auto_cleanup { ~auto_cleanup() { WWhizInterface2Destroy(); } } autoc;

static void GetWWhizDirectory(LPTSTR wwhizPath)
{
    HKEY hKey;
    DWORD type;
	DWORD pathLen = _MAX_PATH;

	wwhizPath[0] = 0;
    if (::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\WWhizInterface",
			0, KEY_READ, &hKey) == ERROR_SUCCESS)
    {
#ifdef _DEBUG
		const char* pathStr = "DebugPath";
#else
		const char* pathStr = "Path";
#endif _DEBUG
        if (::RegQueryValueEx(hKey, pathStr, 0, &type, 
            (LPBYTE)wwhizPath, &pathLen) == ERROR_SUCCESS)
        {
        }

        ::RegCloseKey(hKey);
    }
}


WWhizInterface* __cdecl WWhizInterface2Create(HINSTANCE hInstance, IApplication* pApplication)
{
	// Only allow one interface per instance.
	if (s_wwhizInterface)
		return s_wwhizInterface;

	TCHAR wwhizPath[_MAX_PATH];
	GetWWhizDirectory(wwhizPath);
	if (wwhizPath[_tcslen(wwhizPath) - 1] != '\\')
		_tcscat(wwhizPath, "\\");

#ifdef _DEBUG
	LPCTSTR filename = "WWhizInterface2D.mod";
#else
	LPCTSTR filename = "WWhizInterface2.mod";
#endif //_DEBUG

	// Get the module name and strip the module filename from it, leaving the
	// module path.
	TCHAR moduleName[_MAX_PATH];
	moduleName[0] = 0;
	::GetModuleFileName(hInstance, (TCHAR*)&moduleName, _MAX_PATH);
	TCHAR* ptr = _tcsrchr(moduleName, '\\');
	if (ptr)
	{
		ptr++;
		*ptr = 0;
	}

	_tcscat(moduleName, _T(filename));
	s_wwhizInst = LoadLibrary(moduleName);
	if (!s_wwhizInst)
	{
		_tcscat(wwhizPath, filename);
		s_wwhizInst = LoadLibrary(wwhizPath);
		if (!s_wwhizInst)
		{
				return NULL;
		}
	}

	s_wwhizInterfaceCreate = (pfnWWhizCreate)GetProcAddress(s_wwhizInst, "WWhizInterfaceCreate");
	s_wwhizInterfaceDestroy = (pfnWWhizDestroy)GetProcAddress(s_wwhizInst, "WWhizInterfaceDestroy");
	if (!s_wwhizInterfaceCreate)
	{
		WWhizInterface2Destroy();
		return NULL;
	}

	s_wwhizInterface = (*s_wwhizInterfaceCreate)(pApplication);

	return s_wwhizInterface;
}


void __cdecl WWhizInterface2Destroy()
{
	if (s_wwhizInst)
	{
		if (s_wwhizInterfaceDestroy)
		{
			(*s_wwhizInterfaceDestroy)();
		}
		BOOL ret = ::FreeLibrary(s_wwhizInst);
		s_wwhizInst = NULL;
	}
	s_wwhizInterfaceCreate = NULL;
	s_wwhizInterfaceDestroy = NULL;
	s_wwhizInterface = NULL;
}

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

About the Author

Oz Solomon
Experion
Canada Canada
You may know Oz from his WndTabs days. Oz has long since left client side development to work on web technologies and to consult in the R&D management field.

| Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 30 Jun 2003
Article Copyright 2000 by Oz Solomon
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid