Click here to Skip to main content
15,886,137 members
Articles / Web Development / HTML

A Comprehensive CE Class Library to Replace ATL and MFC

Rate me:
Please Sign up or sign in to vote.
4.48/5 (14 votes)
4 Oct 2000CPOL 278.9K   998   70  
A collection of classes for CE that do not use ATL or MFC, plus an FTP client, database viewer, and sample application that solves beam deflection equations.
#ifndef __CeInk_h__
#define __CeInk_h__

#include "CeWnd.h"

#if (_WIN32_WCE >= 211)
#  include <inkx.h>
#  include <richink.h>
#else
#  include <richink.h>
#endif

class CeInkCtrl: public CeWnd
{
public:
	static void Init()
		{ InitInkX(); }

	BOOL Create(DWORD dwStyle, DWORD dwExStyle, const RECT& rect, HWND hParentWnd, UINT nID, HINSTANCE hInst)
		{ return CeWnd::Create(hInst, WC_INKX, hParentWnd, rect, NULL, dwStyle, dwExStyle, nID); }

	void ShowCommandBar(BOOL bShow)
		{ SendMessage(IM_SHOWCMDBAR, bShow); }
	int GetDataLength()
		{ return (int) SendMessage(IM_GETDATALEN); }
	void ClearAll()
		{ SendMessage(IM_CLEARALL); }
	void SetData ( int cbInkData, BYTE *lpInkData )
		{ SendMessage(IM_SETDATA, (WPARAM) cbInkData, (LPARAM) lpInkData); }
	int GetData ( int cbInkData, BYTE *lpInkData )
		{ return (int) SendMessage(IM_GETDATA, (WPARAM) cbInkData, (LPARAM) lpInkData); }
};


class CeRichInkCtrl: public CeWnd
{
public:
	static void Init()
		{ InitRichInkDLL(); }

	BOOL Create(DWORD dwStyle, DWORD dwExStyle, const RECT& rect, HWND hParentWnd, UINT nID, HINSTANCE hInst)
		{ return CeWnd::Create(hInst, WC_RICHINK, hParentWnd, rect, NULL, dwStyle, dwExStyle, nID); }

//	
//	SF_TEXT		Ascii Text 
//	SF_RTF		Rich Text Format (RTF) 
//	SF_UTEXT	Unicode text
//	SF_PWI		Pocket Word Ink (PWI)
//
	BOOL StreamIn(UINT uFormat, EDITSTREAM* lpStream)
		{ return SendMessage(EM_STREAMIN, uFormat, (LPARAM) lpStream); }

	BOOL StreamOut(UINT uFormat, EDITSTREAM* lpStream)
		{ return SendMessage(EM_STREAMOUT, uFormat, (LPARAM) lpStream); }

	void ClearAll()
		{ SendMessage(EM_CLEARALL); }

// New functions found by experimentation
	void SetPlainBkgnd()
		{ SendMessage(WM_USER+250); }

	void SetLineBkgnd()
		{ SendMessage(WM_USER+251); }

	void SetGraphBkgnd()
		{ SendMessage(WM_USER+252); }

	// Set the zoom for the rich edit control, I know 75/100/150/200/300 all work
	void SetZoom(int nZoom)
		{ SendMessage(WM_USER+290, 0, nZoom); }

	void SelectAll()
		{ SendMessage(WM_USER+206); }

	void GetFormatting(BYTE* pBuf)
		{ SendMessage(WM_USER+212, 0, (LPARAM) pBuf); }

	void SetFormatting(BYTE* pBuf)
		{ SendMessage(WM_USER+213, 0, (LPARAM) pBuf); }

};



//---------------------------------------------------------
//
// Other useful Rich Edit control and Windows messages 
//	that are supported by the Rich Ink control:
//
//		EM_GETSEL
//		EM_SETSEL
//		EM_REPLACESEL
//		EM_GETMODIFY
//		EM_SETMODIFY
//
//		WM_GETTEXTLENGTH
//		WM_GETTEXT
//		WM_SETTEXT 
//
//      WM_CUT
//      WM_COPY
//      WM_PASTE
//      WM_CLEAR
//      EM_CANPASTE
//
// See Microsoft Developer Studio Help or MSDN for more details.
//---------------------------------------------------------



#pragma comment(lib, "inkx.lib")

#endif // __CeInk_h__

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
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions