Click here to Skip to main content
15,883,709 members
Articles / Programming Languages / C++

Locking shareware functions

Rate me:
Please Sign up or sign in to vote.
2.00/5 (13 votes)
18 Sep 2003CPOL1 min read 74K   801   33  
This article describes how to lock some functions in a shareware product. Users can unlock them only after obtaining keyfile
// shwcodeView.h : interface of the CShwcodeView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_SHWCODEVIEW_H__FA6E6F8E_E6F0_11D7_9818_CAEA6E782261__INCLUDED_)
#define AFX_SHWCODEVIEW_H__FA6E6F8E_E6F0_11D7_9818_CAEA6E782261__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "memdc.h"

class CTranspBitmap
{
public:

	CTranspBitmap(){};
	CBitmap m_bmpPlmain;
    CBitmap m_bmpMask;

    BOOL LoadFileBitmap(LPCTSTR szFilename);

    void PrepareMask( 
                  COLORREF clrpTransColor,
                  int iTransPixelX = 0,
                  int iTransPixelY = 0 );

    void DrawTransparentBitmap (CDC* pDC,
                            int xStart, int yStart,
                            int wWidth, int wHeight,
                            CDC* pTmpDC,
                            int xSource = 0,
                            int ySource = 0);

	void PaintBitmap(       CDC*pDC,
                            int xStart, int yStart,
                            int wWidth, int wHeight,
                            int xSource = 0,
                            int ySource = 0);





};
class CShwcodeView : public CScrollView
{
protected: // create from serialization only
	CShwcodeView();
	DECLARE_DYNCREATE(CShwcodeView)

// Attributes
public:
	CShwcodeDoc* GetDocument();
	int m_mode;
	bool bAnimation;

	CTranspBitmap m_tbmp,m_tbmp2;

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CShwcodeView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual void OnInitialUpdate(); // called first time after construct
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
	void PaintLockedModel(CDC *pDC);
	void PaintSecondModel(CDC *pDC,int counter=0);
	void SetDrawMode(int mode);
	void PaintFirstModel(CDC*pDC,int counter=0);
	virtual ~CShwcodeView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CShwcodeView)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in shwcodeView.cpp
inline CShwcodeDoc* CShwcodeView::GetDocument()
   { return (CShwcodeDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SHWCODEVIEW_H__FA6E6F8E_E6F0_11D7_9818_CAEA6E782261__INCLUDED_)

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
Russian Federation Russian Federation
Professional Windows/Java Mobile/Web-applications developer since 2000.

Comments and Discussions