Click here to Skip to main content
15,897,334 members
Articles / Mobile Apps

The StateWizard VC++ Add-in and Engine with Source Code

Rate me:
Please Sign up or sign in to vote.
4.73/5 (24 votes)
26 Mar 2009CPOL12 min read 191K   2.8K   132  
A cross-platform state-oriented application framework and a ClassWizard-like round-trip UML dynamic modeling/development tool that runs in popular IDEs. Aims at providing concurrent, distributed, and real-time application development tools for Win32/Linux
/**********************************************************************
UML StateWizard provides its software under the LGPL License and 
zlib/libpng License.

Email us at info@intelliwizard.com for any information, suggestions and 
feature requestions.

Home Page: http://www.intelliwizard.com
*************************************************************************/

#include "StdAfx.h"
#include ".\WndUtils.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#ifdef VS2005
	#define STR_ADD_IN_KEY "Software\\Microsoft\\VisualStudio\\8.0\\AddIns\\StateWizard2005.Connect"
#else
	#define STR_ADD_IN_KEY "Software\\Microsoft\\VisualStudio\\7.1\\AddIns\\StateMachineWiz.Connect"
#endif

CString GetHelpFileName(){
	unsigned char sAddinFileName[256];
	HKEY hResult=0;
	CString sHelpFile;
	if (RegOpenKey(HKEY_CURRENT_USER, 
		STR_ADD_IN_KEY,
		&hResult) == ERROR_SUCCESS)
	{
		DWORD nSize=255;
		DWORD nType;
		if (RegQueryValueEx(hResult, "SatelliteDllPath", NULL, &nType, sAddinFileName, &nSize) == ERROR_SUCCESS)
		{
			sHelpFile = sAddinFileName;
			sHelpFile = sHelpFile + "\\StateMachineWiz.chm";
		}
		RegCloseKey(hResult);
	}
	return sHelpFile;
}


///////////////////////////////////////////////////////////////
void StrTrace(LPCTSTR sFmt, ...)
{
	FILE *g_pFile=NULL;

	g_pFile = _tfopen(_T("C:\\statewizard_debug.txt"), _T("at"));

	if (g_pFile==NULL) return;

	int nSize = 0;
	TCHAR buff[512];
	va_list args;
	va_start(args, sFmt);

	_vsntprintf( buff, sizeof(buff), sFmt, args);

	_fputts(buff, g_pFile);
	fflush(g_pFile);
	fclose(g_pFile);
}

void XErrorMsg(LPCTSTR sMsg, ...)
{
	if (sMsg==NULL) return;
	
	TCHAR sMsgBuf[513];
	memset(sMsgBuf,0, sizeof(sMsgBuf));

	va_list   ArgList;
	va_start(ArgList, sMsg);

	// int _vsnprintf(  char *buffer,   size_t count,   const char *format,  va_list argptr );
	_vsntprintf(sMsgBuf, sizeof(sMsgBuf)/sizeof(TCHAR)-1, sMsg, ArgList);

	va_end(ArgList);

	AfxMessageBox(sMsgBuf, MB_ICONERROR|MB_OK);
}

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)
United States United States
Alex "Question is more important than the answer."

Comments and Discussions