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
/////////////////////////////////////////////////////////////////////////////
//
// RASUtil.h : classes wrapping the functionality of the RAS API
//
/////////////////////////////////////////////////////////////////////////////

#ifndef __CeRas_h__
#define __CeRas_h__

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

#include <ras.h>		// Remote Access Service API
#include <raserror.h>	// RAS Error codes

#include "CeThread.h"		// critical section class
#include "CeMap.h"
#include "CeArray.h"
#include "CeString.h"

typedef CeArray<CeString> CeStringArray;

/////////////////////////////////////////////////////////////////////////////
// The classes in this file include:

class CeRasDevInfo;
class CeRasEntryName;
class CeRasEntry;
class CeRasDialParams;
class CeRasConn;
class CeRasDialExt;

class CeRasAmb;
class CeRasPppNbf;
class CeRasPppIpx;
class CeRasPppIp;

/////////////////////////////////////////////////////////////////////////////
// CeRasDevInfo
typedef RASDEVINFO _rasdevinfo;
class CeRasDevInfo : public _rasdevinfo
{
public:
	CeRasDevInfo()
	{
		memset((_rasdevinfo *)this, 0, sizeof _rasdevinfo);
		dwSize = sizeof(RASDEVINFO);
	}
	~CeRasDevInfo() {}

#ifndef _WIN32_WCE
	static int GetAll(RASDEVINFO** arDevInfo);
#endif

};

/////////////////////////////////////////////////////////////////////////////
// CeRasConnStatus
typedef RASCONNSTATUS _rasconnstatus;
class CeRasConnStatus : public _rasconnstatus
{
public:
	CeRasConnStatus()
	{
		memset((_rasconnstatus *)this, 0, sizeof _rasconnstatus);
		dwSize = sizeof(RASCONNSTATUS);
	}
	~CeRasConnStatus() {}
};

/////////////////////////////////////////////////////////////////////////////
// CeRasEntryName
typedef RASENTRYNAME _rasentryname;
class CeRasEntryName : public _rasentryname
{
public:
	CeRasEntryName()
	{
		memset((_rasentryname*)this, 0, sizeof _rasentryname);
		dwSize = sizeof _rasentryname;
	}
	~CeRasEntryName() {}
};


/////////////////////////////////////////////////////////////////////////////
// CeRasDialExt
typedef RASDIALEXTENSIONS _rasdialextensions;
class CeRasDialExt : public _rasdialextensions
{
public:
	CeRasDialExt(DWORD dwfOpt = 0, HWND hwnd = NULL)
	{
		memset((_rasdialextensions*)this, 0, sizeof _rasdialextensions);
		dwSize = sizeof _rasdialextensions;
		dwfOptions = dwfOpt;
		hwndParent = hwnd;

	}
	~CeRasDialExt() {}

	DWORD GetOptions() const { return dwfOptions; }
	void  SetOptions(DWORD dwfOpt) { dwfOptions = dwfOpt; }

	HWND GetParentHWnd() const { return hwndParent; }
	void SetParentHWnd(HWND hwnd) { hwndParent = hwnd; }
};


/////////////////////////////////////////////////////////////////////////////
// CeRasAmb
typedef RASAMB _rasamb;
class CeRasAmb : public _rasamb
{
public:
	CeRasAmb()
	{
		memset((_rasamb *)this, 0, sizeof _rasamb);
		dwSize = sizeof _rasamb;
	}
	~CeRasAmb() {}
};

/////////////////////////////////////////////////////////////////////////////
// CeRasPppNbf
typedef RASPPPNBF _raspppnbf;
class CeRasPppNbf : public _raspppnbf
{
public:
	CeRasPppNbf()
	{
		memset((_raspppnbf *)this, 0, sizeof _raspppnbf);
		dwSize = sizeof(RASPPPNBF);
	}
	~CeRasPppNbf() {}
};

/////////////////////////////////////////////////////////////////////////////
// CeRasPppIpx
typedef RASPPPIPX _raspppipx;
class CeRasPppIpx : public _raspppipx
{
public:
	CeRasPppIpx()
	{
		memset((_raspppipx *)this, 0, sizeof _raspppipx);
		dwSize = sizeof(RASPPPIPX);
	}
	~CeRasPppIpx() {}
};

/////////////////////////////////////////////////////////////////////////////
// CeRasPppIp
typedef RASPPPIP _raspppip;
class CeRasPppIp : public _raspppip
{
public:
	CeRasPppIp()
	{
		memset((_raspppip *)this, 0, sizeof _raspppip);
		dwSize = sizeof(RASPPPIP);
	}
	~CeRasPppIp() {}
};

/////////////////////////////////////////////////////////////////////////////
// CeRasEntry
typedef RASENTRY _rasentry;
class CeRasEntry : public _rasentry
{
public:
	CeRasEntry(LPCTSTR lpszDevName=NULL, LPCTSTR lpszPhone=NULL, LPCTSTR lpszAreaCode=NULL, LPCTSTR lpszCountryCode=NULL);
	~CeRasEntry();

	// get/set entry using this object
	void Create(LPCTSTR szName);
	void Get(LPCTSTR szName, LPBYTE* lpbDevInfo = NULL);
	void Set(LPCTSTR szName, LPBYTE lpbDevInfo = NULL);

#ifndef _WIN32_WCE
	void SetWin95(LPCTSTR szName);
#endif

	void SetDevice(LPCTSTR strDevName);
	void SetPhone(LPCTSTR strPhoneNumber, LPCTSTR  strAreaCode=NULL, LPCTSTR strCountryCode=NULL);

	static void Rename(LPCTSTR szNameTo, LPCTSTR szNameFrom);
	static void Delete(LPCTSTR szName);

	static int GetAll(RASENTRYNAME** arEntries);

	static long StringToIP(LPCTSTR szIP);
	static RASIPADDR StringToRASIP(LPCTSTR strIP);

private:
	static void IPHelper();

	CeStringArray m_arAdditional;
};

/////////////////////////////////////////////////////////////////////////////
// CeRasDialParams
typedef RASDIALPARAMS _rasdialparams;
class CeRasDialParams : public _rasdialparams
{
public:
	CeRasDialParams(LPCTSTR lpszEntry, LPCTSTR lpszUserName, LPCTSTR lpszPassword)
	{
		memset((_rasdialparams*)this, 0, sizeof _rasdialparams);
		dwSize = sizeof _rasdialparams;
		_tcscpy(szEntryName, lpszEntry);
		_tcscpy(szUserName, lpszUserName);
		_tcscpy(szPassword, lpszPassword); 
	}
	~CeRasDialParams() {}

	// Note that the default copy constructor is just dandy
};


typedef RASCONN _rasconn;
class CeRasConn : public _rasconn
{
protected:
	//
	// Monitors asynchronous connections automatically
	//
	class CeRasConnMapper
	{
	private:
		CeCriticalSection m_cs;
		//CeSimpleMap<HRASCONN, CeRasConn*> m_mapConn;
		CeSimpleMap<HRASCONN, void*> m_mapConn;

	public:
		BOOL AddMapping(HRASCONN hRASConn, CeRasConn* pConn)
		{
			m_cs.Enter();
			m_mapConn.Add(hRASConn, pConn);
			m_cs.Leave();

			return TRUE;
		}

		CeRasConn* GetMapping(HRASCONN hRASConn)
		{
			m_cs.Enter();
			CeRasConn* pConn = (CeRasConn *) m_mapConn.Lookup(hRASConn);
			m_cs.Leave();

			return pConn;
		}

		CeRasConn* RemoveMapping(HRASCONN hRASConn)
		{
			m_cs.Enter();
			CeRasConn* pConn = (CeRasConn*) m_mapConn.Lookup(hRASConn);
			if (NULL != pConn)
				m_mapConn.Remove(hRASConn);
			m_cs.Leave();

			return pConn;
		}
	};

	static CeRasConnMapper s_mapConn;

public:
	// DECLARE_DYNAMIC(CeRasConn)

	CeRasConn();
	virtual ~CeRasConn();

	DWORD SetTimeout(DWORD dwMilliseconds)
		{
			DWORD dwOld = m_dwTimeOut;
			m_dwTimeOut = dwMilliseconds;
			return dwOld;
		}
	DWORD GetTimeout() const
		{ return m_dwTimeOut; }

	int SetRetries(int nRetries)
		{
			int nOld = m_nRetries;
			m_nRetries = nRetries;
			return nOld;
		}
	DWORD GetRetries() const
		{ return m_nRetries; }

	void Dial(LPRASDIALPARAMS lpRasDialParams, BOOL bSynchronous=TRUE, LPRASDIALEXTENSIONS lpRASDialExt=NULL);
	void Hangup(BOOL bSynchronous=TRUE);

	static CeString GetStatus(RASCONNSTATE rasconnstate);
	DWORD GetStatus(CeRasConnStatus& rasState);
	CeString GetStatus();
	BOOL IsConnected();

#if !defined(_WIN32_WCE)
	void GetProjectionInfo(LPRASAMB pInfo);
	void GetProjectionInfo(LPRASPPPNBF pInfo);
	void GetProjectionInfo(LPRASPPPIPX pInfo);
	void GetProjectionInfo(LPRASPPPIP pInfo);
#endif

	static VOID WINAPI RasDialNotificationFn(HRASCONN hrasconn, UINT unMsg, RASCONNSTATE rascs, DWORD dwError, DWORD dwExtendedError);
	virtual void OnDialStatus(UINT unMsg, RASCONNSTATE rascs, DWORD dwError, DWORD dwExtendedError);
	virtual void LogEvent(short nPriority, LPCTSTR szEvent) const;

	static int GetAll(RASCONN** arConn);

	BOOL IsDialComplete() const
		{ return m_bComplete; }
	void SetDialComplete(DWORD dwError);
	void WaitForDialComplete();

#ifdef _DEBUG
//	virtual void AssertValid( ) const;
//	virtual void Dump( CDumpContext& dc ) const;
#endif

private:
	// Dialing parameters for active call
//	LPTSTR m_lpszPhoneBook;
	LPRASDIALPARAMS m_lpRasDialParams;
	BOOL m_bSynchronous;

	// Connection complete status
	BOOL m_bComplete;

	// Event used to make WaitForConnect() work
	CeManualEvent m_eventDialComplete;

	// Dialing status for active dial
	UINT m_unMsg;
	RASCONNSTATE m_rascs;
	DWORD m_dwError;
	DWORD m_dwExtendedError;
	DWORD m_dwTimeOut;
	int m_nRetries;
};

#endif // __CeRas_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
Web01 | 2.8.150326.1 | Last Updated 5 Oct 2000
Article Copyright 2000 by Kenny G
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid