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

Locking shareware functions

, 18 Sep 2003 CPOL
This article describes how to lock some functions in a shareware product. Users can unlock them only after obtaining keyfile
shwcode.zip
shwcode
shwcode.clw
shwcode.dsw
res
shwcodeDoc.ico
shwcode.ico
Toolbar.bmp
shwcode.dsp
Release
1224.bmp
shwcode.exe
1223.bmp
MVC10C0.TMP
// shwcodeDoc.cpp : implementation of the CShwcodeDoc class
//

#include "stdafx.h"
#include "shwcode.h"

#include "shwcodeDoc.h"
#include "shwcodeView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CShwcodeDoc

IMPLEMENT_DYNCREATE(CShwcodeDoc, CDocument)

BEGIN_MESSAGE_MAP(CShwcodeDoc, CDocument)
	//{{AFX_MSG_MAP(CShwcodeDoc)
	ON_COMMAND(ID_VIEW_PATTERN1, OnViewPattern1)
	ON_COMMAND(ID_VIEW_PATTERN2, OnViewPattern2)
	ON_COMMAND(ID_VIEW_LOCKEDPATTERN, OnViewLockedpattern)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CShwcodeDoc construction/destruction

CShwcodeDoc::CShwcodeDoc()
{
	// TODO: add one-time construction code here

}

CShwcodeDoc::~CShwcodeDoc()
{
}

BOOL CShwcodeDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CShwcodeDoc serialization

void CShwcodeDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CShwcodeDoc diagnostics

#ifdef _DEBUG
void CShwcodeDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CShwcodeDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CShwcodeDoc commands

void CShwcodeDoc::OnViewPattern1() 
{
	CShwcodeView*pv=NULL;
	pv=(CShwcodeView*)GetPatternView();
	if(!pv) return;
	pv->SetDrawMode(1);
	pv->RedrawWindow();
	
}

void CShwcodeDoc::OnViewPattern2() 
{
	CShwcodeView*pv=NULL;
	pv=(CShwcodeView*)GetPatternView();
	if(!pv) return;
	pv->SetDrawMode(2);
	pv->RedrawWindow();
	
}

void CShwcodeDoc::OnViewLockedpattern() 
{
	CShwcodeView*pv=NULL;
	pv=(CShwcodeView*)GetPatternView();
	if(!pv) return;
	pv->SetDrawMode(3);
	pv->RedrawWindow();
	
}

DWORD CShwcodeDoc::GetPatternView()
{
	POSITION pos=this->GetFirstViewPosition();
	CView*pv=this->GetNextView(pos);
	return (DWORD)pv;

}

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)

Share

About the Author

va_dev
Software Developer
Russian Federation Russian Federation
Professional Windows/Java Mobile/Web-applications developer since 2000.

| Advertise | Privacy | Mobile
Web03 | 2.8.141022.2 | Last Updated 19 Sep 2003
Article Copyright 2003 by va_dev
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid