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

A comprehensive CE class library to replace ATL and MFC

, 4 Oct 2000 CPOL
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.
kgwince-old.zip
WinCe
BeamEx
app.ico
BeamEx.dsp
BeamEx.dsw
BeamEx.ini
BeamEx.plg
bitmap1.bmp
bmp00001.bmp
bmp00002.bmp
calc.bmp
calc16.bmp
circ_cross.ico
cir_cross.ico
cross_4.ico
help16.bmp
help4.bmp
ico00001.ico
ico00002.ico
ico00005.ico
ico00008.ico
ico00009.ico
ico00010.ico
icon1.ico
icon2.ico
icon4.ico
id_downl.bmp
Install
BeamEx.inf
BeamEx.ini
BeamEx.MIPS_PPCBW.CAB
BeamEx.MIPS_PPCColor.CAB
BeamEx.SH3_PPCColor.CAB
Setup.exe
i_cross.ico
l_cross.ico
magenic.ico
mssccprj.scc
obl_corss.ico
obl_cross.ico
options.bmp
options1.bmp
ping16.bmp
rect_cross.ico
scene_5.ico
scene_6.ico
tri_cross.ico
vssver.scc
CeLib
CeLabel.inl
CeLib.aps
CeLib.dsp
CeLib.dsw
CeLib.old
CeLib.plg
CeLib.vcp
CeMisc.inl
CeProperty.inl
CeTab.inl
CeWnd.inl
mssccprj.scc
vssver.scc
WinLib.dsp
WinLib.dsw
dbView
bitmap1.bmp
bmp00001.bmp
db5.bmp
dbView.aps
DbView.dsp
dbView.dsw
dbView.old
dbView.plg
DbView.vcp
deldb.bp2
deldb5.bmp
delrec.bp2
delrecor.bmp
help16.bmp
help4.bmp
icon1.ico
icon2.ico
Install
dbView.inf
dbView.ini
Setup.exe
magenic.bmp
magenic.ico
mssccprj.scc
vssver.scc
ftpView
appicon.ico
bitmap1.bmp
bitmap2.bmp
bitmap3.bmp
bitmap4.bmp
bmp00001.bmp
bmp00002.bmp
db5.bmp
deldb.bp2
delrec.bp2
FtpView.dsp
ftpView.dsw
FtpView.old
ftpView.plg
FtpView.vcl
FtpView.vcp
help16.bmp
help4.bmp
ico00001.ico
ico00002.ico
ico171.ico
ico35.ico
icon1.ico
icon2.ico
imagelis.bmp
IMAGES.bmp
Install
ftpView.inf
ftpView.ini
Setup.exe
vssver.scc
magenic.bmp
magenic.ico
mssccprj.scc
options.bmp
options1.bmp
seperato.bmp
vssver.scc
Setup
ico101.ico
Setup.aps
Setup.dsp
setup.ico
Setup.plg
WinCe.dsw
WinLib.dsw
kgwince.zip
app.ico
BeamEx.dsp
BeamEx.dsw
BeamEx.ini
BeamEx.plg
BeamEx.vcl
BeamEx.vcp
bitmap1.bmp
bmp00001.bmp
bmp00002.bmp
calc.bmp
calc16.bmp
circ_cross.ico
cir_cross.ico
cross_4.ico
help16.bmp
help4.bmp
ico00001.ico
ico00002.ico
ico00005.ico
ico00008.ico
ico00009.ico
ico00010.ico
icon1.ico
icon2.ico
icon4.ico
id_downl.bmp
BeamEx.inf
BeamEx.ini
Setup.exe
i_cross.ico
l_cross.ico
magenic.ico
mssccprj.scc
obl_corss.ico
obl_cross.ico
options.bmp
options1.bmp
ping16.bmp
rect_cross.ico
scene_5.ico
scene_6.ico
tri_cross.ico
vssver.scc
CeFtp.vcp
CeFtp.vcw
CeLabel.inl
CeLib.aps
CeLib.dsp
CeLib.dsw
CeLib.plg
CeLib.vcl
CeLib.vcp
CeMisc.inl
CeProperty.inl
CeTab.inl
CeWnd.inl
mssccprj.scc
vssver.scc
WinLib.dsp
WinLib.dsw
bitmap1.bmp
bitmap2.bmp
bmp00001.bmp
db5.bmp
DbView.dsp
dbView.dsw
dbView.plg
DbView.vcl
DbView.vcp
deldb.bp2
deldb5.bmp
delrec.bp2
delrecor.bmp
help16.bmp
help4.bmp
icon1.ico
icon2.ico
dbView.inf
dbView.ini
Setup.exe
magenic.bmp
magenic.ico
menu1_5.bmp
mssccprj.scc
vssver.scc
appicon.ico
bitmap1.bmp
bitmap2.bmp
bitmap3.bmp
bitmap4.bmp
bmp00001.bmp
bmp00002.bmp
db5.bmp
deldb.bp2
delrec.bp2
FtpView.dsp
ftpView.dsw
ftpView.plg
FtpView.vcl
FtpView.vcp
FtpView.vcw
help16.bmp
help4.bmp
ico00001.ico
ico00002.ico
ico171.ico
ico35.ico
icon1.ico
icon2.ico
imagelis.bmp
IMAGES.bmp
ftpView.inf
ftpView.ini
Setup.exe
vssver.scc
magenic.bmp
magenic.ico
mssccprj.scc
newmenu.bmp
options.bmp
options1.bmp
rcdata1.bin
seperato.bmp
toolbar1.bmp
vssver.scc
WinCe.dsw
WinCe.vcw
#ifndef __CeMisc_h__
#define __CeMisc_h__

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

#ifdef _WIN32_PPC_
# include <aygshell.h>
BOOL CeShowSip(BOOL bShow);
BOOL CeSipCenterWindow(HWND hwnd);
BOOL CeSipSizeWindow(HWND hwnd);
#endif

HINSTANCE CeGetAppInstance();
HWND CeGetAppWindow();

#include <tchar.h>

inline bool CeIsPPC()
{
#ifdef _WIN32_WCE
	WCHAR szPlatform[32];
	if (::SystemParametersInfo(SPI_GETPLATFORMTYPE, 32, szPlatform, 0))
		return (!lstrcmpiW(szPlatform, L"Palm PC")) ? true: false;
#endif // _WIN32_WCE

	return false;
}

inline bool CeIsHPC()
{
#ifdef _WIN32_WCE
	WCHAR szPlatform[32];
	if (::SystemParametersInfo(SPI_GETPLATFORMTYPE, 32, szPlatform, 0))
		return (!lstrcmpiW(szPlatform, L"HPC")) ? true: false;
#endif // _WIN32_WCE

	return false;
}

inline bool CeIsHPCPro()
{
#ifdef _WIN32_WCE
	WCHAR szPlatform[32];
	if (::SystemParametersInfo(SPI_GETPLATFORMTYPE, 32, szPlatform, 0))
		return (!lstrcmpiW(szPlatform, L"Jupiter")) ? true: false;
#endif // _WIN32_WCE

	return false;
}

inline bool CeIsPocketPC()
{
#if defined(_WIN32_PPC_) && _WIN32_WCE >= 300
	return true;
#else
	return false;
#endif
}


#define ProgressCtrl_SetRange(hWnd, nLower, nUpper) \
	 ::SendMessage(hWnd, PBM_SETRANGE, 0, MAKELPARAM(nLower, nUpper))
#define ProgressCtrl_SetPos(hWnd, nPos) \
	::SendMessage(hWnd, PBM_SETPOS, nPos, 0L)
#define ProgressCtrl_OffsetPos(hWnd, nPos) \
	::SendMessage(hWnd, PBM_DELTAPOS, nPos, 0L)
#define ProgressCtrl_SetStep(nStep) \
	::SendMessage(hWnd, PBM_SETSTEP, nStep, 0L)
#define ProgressCtrl_StepIt() \
	::SendMessage(hWnd, PBM_STEPIT, 0, 0L)

//
// Short cuts for funtions I like to use that don't exist in Windows CE Win32 ...
//
#ifndef EqualMemory
# define EqualMemory(Destination,Source,Length) (!memcmp((Destination),(Source),(Length)))
#endif
#ifndef MoveMemory
# define MoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length))
#endif
#ifndef CopyMemory
# define CopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length))
#endif
#ifndef FillMemory
# define FillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length))
#endif
#ifndef ZeroMemory
# define ZeroMemory(Destination,Length) memset((Destination),0,(Length))
#endif

class CeSize;
class CeRect;
class CePoint;

/////////////////////////////////////////////////////////////////////////////
// CeSize - An extent, similar to Windows SIZE structure.

class CeSize : public tagSIZE
{
public:

// Constructors
	CeSize();
	CeSize(int initCX, int initCY);
	CeSize(SIZE initSize);
	CeSize(POINT initPt);
	CeSize(DWORD dwSize);

// Operations
	BOOL operator==(SIZE size) const;
	BOOL operator!=(SIZE size) const;
	void operator+=(SIZE size);
	void operator-=(SIZE size);

// Operators returning CeSize values
	CeSize operator+(SIZE size) const;
	CeSize operator-(SIZE size) const;
	CeSize operator-() const;

// Operators returning CePoint values
	CePoint operator+(POINT point) const;
	CePoint operator-(POINT point) const;

// Operators returning CeRect values
	CeRect operator+(const RECT* lpRect) const;
	CeRect operator-(const RECT* lpRect) const;
};

/////////////////////////////////////////////////////////////////////////////
// CePoint - A 2-D point, similar to Windows POINT structure.

class CePoint : public tagPOINT
{
public:

// Constructors
	CePoint();
	CePoint(int initX, int initY);
	CePoint(POINT initPt);
	CePoint(SIZE initSize);
	CePoint(DWORD dwPoint);

// Operations
	void Offset(int xOffset, int yOffset);
	void Offset(POINT point);
	void Offset(SIZE size);
	BOOL operator==(POINT point) const;
	BOOL operator!=(POINT point) const;
	void operator+=(SIZE size);
	void operator-=(SIZE size);
	void operator+=(POINT point);
	void operator-=(POINT point);

// Operators returning CePoint values
	CePoint operator+(SIZE size) const;
	CePoint operator-(SIZE size) const;
	CePoint operator-() const;
	CePoint operator+(POINT point) const;

// Operators returning CeSize values
	CeSize operator-(POINT point) const;

// Operators returning CeRect values
	CeRect operator+(const RECT* lpRect) const;
	CeRect operator-(const RECT* lpRect) const;
};

/////////////////////////////////////////////////////////////////////////////
// CeRect - A 2-D rectangle, similar to Windows RECT structure.

typedef const RECT* LPCRECT;    // pointer to read/only RECT

class CeRect : public tagRECT
{
public:

// Constructors
	CeRect();
	CeRect(int l, int t, int r, int b);
	CeRect(const RECT& srCeRect);
	CeRect(LPCRECT lpSrCeRect);
	CeRect(POINT point, SIZE size);
	CeRect(POINT topLeft, POINT bottomRight);

// Attributes (in addition to RECT members)
	int Width() const;
	int Height() const;
	CeSize Size() const;
	CePoint& TopLeft();
	CePoint& BottomRight();
	const CePoint& TopLeft() const;
	const CePoint& BottomRight() const;
	CePoint CenterPoint() const;

	// convert between CeRect and LPRECT/LPCRECT (no need for &)
	operator LPRECT();
	operator LPCRECT() const;

	BOOL IsRectEmpty() const;
	BOOL IsRectNull() const;
	BOOL PtInRect(POINT point) const;

// Operations
	void SetRect(int x1, int y1, int x2, int y2);
	void SetRect(POINT topLeft, POINT bottomRight);
	void SetRectEmpty();
	void CopyRect(LPCRECT lpSrCeRect);
	BOOL EqualRect(LPCRECT lpRect) const;

	void InflateRect(int x, int y);
	void InflateRect(SIZE size);
	void InflateRect(LPCRECT lpRect);
	void InflateRect(int l, int t, int r, int b);
	void DeflateRect(int x, int y);
	void DeflateRect(SIZE size);
	void DeflateRect(LPCRECT lpRect);
	void DeflateRect(int l, int t, int r, int b);

	void OffsetRect(int x, int y);
	void OffsetRect(SIZE size);
	void OffsetRect(POINT point);
	void NormalizeRect();

	// operations that fill '*this' with result
	BOOL IntersectRect(LPCRECT lpRect1, LPCRECT lpRect2);
	BOOL UnionRect(LPCRECT lpRect1, LPCRECT lpRect2);
	BOOL SubtractRect(LPCRECT lpRectSrc1, LPCRECT lpRectSrc2);

// Additional Operations
	void operator=(const RECT& srCeRect);
	BOOL operator==(const RECT& rect) const;
	BOOL operator!=(const RECT& rect) const;
	void operator+=(POINT point);
	void operator+=(SIZE size);
	void operator+=(LPCRECT lpRect);
	void operator-=(POINT point);
	void operator-=(SIZE size);
	void operator-=(LPCRECT lpRect);
	void operator&=(const RECT& rect);
	void operator|=(const RECT& rect);

// Operators returning CeRect values
	CeRect operator+(POINT point) const;
	CeRect operator-(POINT point) const;
	CeRect operator+(LPCRECT lpRect) const;
	CeRect operator+(SIZE size) const;
	CeRect operator-(SIZE size) const;
	CeRect operator-(LPCRECT lpRect) const;
	CeRect operator&(const RECT& rect2) const;
	CeRect operator|(const RECT& rect2) const;
	CeRect MulDiv(int nMultiplier, int nDivisor) const;

// Window short cuts
	void ScreenToClient(HWND hWnd);
	void ClientToScreen(HWND hWnd);
};



///////////////////////////////////////////////////////////////////////////////
//
// Functions that are not contained in any header file but exist
// in all versions of CE.
// Note: these functions are documented only in Platform Builder, and
// are likely to be restricted in future versions of Windows CE.
//
// The functions GetSystemMemoryDivision() and SetSystemMemoryDivision()
// allow you to change the relationship between memory and the object store.
// The prototypes are:

#ifdef __cplusplus
extern "C"{
#endif 

 BOOL WINAPI GetSystemMemoryDivision(LPDWORD storePages, LPDWORD ramPages, LPDWORD pageSize);
DWORD WINAPI SetSystemMemoryDivision(DWORD storePages);

#ifdef __cplusplus
}
#endif

// The function returns SYSMEM_CHANGED if executed successfully. 
// The function returns SYSMEM_FAILED if storePages is out of range. 
// If SYSMEM_FAILED is returned, you can get further information by calling GetLastError().
// If a reboot is necessary for the change to take effect, the function returns SYSMEM_MUSTREBOOT. 
// If a previous call returned SYSMEM_MUSTREBOOT, the function
//   returns SYSMEM_REBOOTPENDING. In this situation, the boundary
//   cannot be adjusted further until the reboot occurs.

// You cannot shrink system memory or the object store memory beyond 256K
//   each, including space for existing files and records.
///////////////////////////////////////////////////////////////////////////////





///////////////////////////////////////////////////////////////////////////////
//
//	Class Description:
//			Put up the wait cursor and destry it on destruction.
//
///////////////////////////////////////////////////////////////////////////////
class CeWaitCursor
{
private:
	// Set the Wait cursor
	HCURSOR m_hCursor;
public:
	CeWaitCursor()
		{ Wait(); }
	~CeWaitCursor()
		{ Restore(); }

	void Wait()
		{ m_hCursor = ::SetCursor(::LoadCursor(NULL, IDC_WAIT)); }
	void Restore()
		{ ::SetCursor(m_hCursor); }
};





// implementation in inline functions
#include "CeMisc.inl"

#endif // __CeMisc_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)

Share

About the Author

Kenny G

United States United States
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141220.1 | Last Updated 5 Oct 2000
Article Copyright 2000 by Kenny G
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid