Click here to Skip to main content
15,896,201 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 282.7K   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 __Res_h__
#define __Res_h__

#include "CeModule.h"

typedef struct tagVS_FIXEDFILEINFO_CE
{
    DWORD   dwSignature;            /* e.g. 0xfeef04bd */
    DWORD   dwStrucVersion;         /* e.g. 0x00000042 = "0.42" */
    DWORD   dwFileVersionMS;        /* e.g. 0x00030075 = "3.75" */
    DWORD   dwFileVersionLS;        /* e.g. 0x00000031 = "0.31" */
    DWORD   dwProductVersionMS;     /* e.g. 0x00030010 = "3.10" */
    DWORD   dwProductVersionLS;     /* e.g. 0x00000031 = "0.31" */
    DWORD   dwFileFlagsMask;        /* = 0x3F for version "0.42" */
    DWORD   dwFileFlags;            /* e.g. VFF_DEBUG | VFF_PRERELEASE */
    DWORD   dwFileOS;               /* e.g. VOS_DOS_WINDOWS16 */
    DWORD   dwFileType;             /* e.g. VFT_DRIVER */
    DWORD   dwFileSubtype;          /* e.g. VFT2_DRV_KEYBOARD */
    DWORD   dwFileDateMS;           /* e.g. 0 */
    DWORD   dwFileDateLS;           /* e.g. 0 */
}
VS_FIXEDFILEINFO_CE;


#define MAX_VAR				16
#define MAX_VAR_INFO		16
#define MAX_STRING_TABLE	16
#define MAX_STRING_PAIR		16
#define MAX_STIRNG_LENGTH	128

class CeVar
{
public:
	WORD m_wCnt;
	DWORD m_dwValue[MAX_VAR];
};

class CeVarFileInfo
{
public:
	WORD m_wCnt;
	CeVar m_var[MAX_VAR_INFO];
};

class CeStringPair
{
public:
	WCHAR m_wszKey[MAX_STIRNG_LENGTH];
	WCHAR m_wszValue[MAX_STIRNG_LENGTH];
};

class CeStringTable
{
public:
	WCHAR m_wszKey[MAX_STIRNG_LENGTH];
	DWORD m_dwKey;
	WORD m_wCnt;
	CeStringPair m_sp[MAX_STRING_PAIR];
};

class CeStringFileInfo
{
public:
	WORD m_wCnt;
	CeStringTable m_st[MAX_STRING_TABLE];
};


class CeVersionInfo
{
public:
	VS_FIXEDFILEINFO_CE m_fileInfo;
	CeVarFileInfo m_vfi;
	CeStringFileInfo m_sfi;

	WCHAR m_wszCompanyName[MAX_STIRNG_LENGTH];
	WCHAR m_wszFileDescription[MAX_STIRNG_LENGTH];
	WCHAR m_wszFileVersion[MAX_STIRNG_LENGTH];
	WCHAR m_wszInternalName[MAX_STIRNG_LENGTH];
	WCHAR m_wszOriginalFilename[MAX_STIRNG_LENGTH];
	WCHAR m_wszProductName[MAX_STIRNG_LENGTH];
	WCHAR m_wszProductVerion[MAX_STIRNG_LENGTH];
	WCHAR m_wszFileCopyright[MAX_STIRNG_LENGTH];


	BOOL Load(LPBYTE pDataIn);
	CeVersionInfo();
};

class CeResource: public CeModule
{
public:
	HANDLE m_hResFile;
	bool m_bUpdating;

	struct SCallbackArray
	{
		SCallbackArray()
			{ wCnt = 0; }

		WORD rgwRes[16];
		WORD wCnt;
	};

	CeResource(HINSTANCE hInst = NULL);
	CeResource(LPCTSTR lpsz);
	~CeResource();

// Methods for retrieving resources
	bool Load(LPCTSTR lpLibFileName);
	HRSRC FindResource(LPCTSTR lpName, LPCTSTR lpType, WORD wLanguage=0);
	HRSRC FindResource(UINT nName, LPCTSTR lpType, WORD wLanguage=0);
	LPVOID LoadResource(HRSRC hRsrc, DWORD& dwSize);

#ifndef _WIN32_WCE

// Methods for modifiy resources
	bool BeginUpdate(LPCTSTR szExe, BOOL bDeleteExistingResources/*=FALSE*/);
	bool EndUpdate(BOOL bDisardChanges/*=FALSE*/);
	bool Update(LPCTSTR lpType, LPCTSTR lpName, WORD wLanguage, LPVOID lpData, DWORD cbData);

// Methods for enumerating resources
	void EnumTypes(SCallbackArray& arTypes);
	void EnumResources(SCallbackArray* par, WORD wType);

private:
	static BOOL CALLBACK EnumResTypeProc( HINSTANCE hModule, LPTSTR lpszType, LONG lParam);
	static BOOL CALLBACK EnumResNameProc(HANDLE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG lParam);

#endif 
};


#endif // __Res_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