Click here to Skip to main content
15,883,734 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.3K   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.
// DbMainWnd.h
#include "CeLib.h"
#include <shellapi.h>
//extern CeModule theApp;

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

#define SORTCOL_NAME	1
#define SORTCOL_SIZE	2
#define SORTCOL_TYPE	3
#define SORTCOL_DATE	4
#define SORTCOL_ATTRIB	5

typedef struct tagLISTSORTINFO
{
	tagLISTSORTINFO()
	{
		// Sort the list after adding
		hwndList = NULL;
		nColumnNo = -1;
		nColType = SORTCOL_NAME;
		bAscending = true;
	}

	HWND hwndList;
	int	 nColumnNo;
	int  nColType;
	bool bAscending;

}
LISTSORTINFO;

extern LISTSORTINFO g_sortinfo;

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

typedef struct tagOPTIONS
{
	bool m_bUseSysIcons;
	bool m_bCloseButton;
	bool m_bIconbar;
	bool m_bROM;

	bool m_bCol_Type;
	bool m_bCol_Size;
	bool m_bCol_Date;
	bool m_bCol_Attrib;
	
	void SaveToRegistry();
	void RestoreFromRegistry();
}
OPTIONS;

extern OPTIONS g_options;


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

class CeMainWnd: public CeSplitFrame
{
private:
	void CreateBars();

	DWORD m_dwFontSize;
	HFONT m_hFont;

	HWND m_hwndList;
	HWND m_hwndTree;

	// quick hack, should change
	HIMAGELIST m_ilSmall;
	HIMAGELIST m_hImages;
	CeString m_strCurrentDirectory;
	bool m_bCurrentFtp;

	NOTIFYICONDATA m_nid;

private:
	void SetCtrlFont(HFONT hFont);

	void OnRun();
	void OnDelete();
	void OnRename();
	void OnNewFolder();
	void OnNewShortcut();
	void OnEmptyRecycleBin();

	void OnProperties();
	void OnAbout();
	void OnOptions();
	void OnFont();

	void OnNewSite();
	void OnRefresh();

	CeFtpClient m_ftpConn;
	HTREEITEM m_hConnected;

	void StoreOptions();
	void LoadOptions();
	void AddColumns();

	CeString GetTreePath(HTREEITEM Item, bool& bFtp);
	BOOL PopulateDirectory(HTREEITEM hItem, LPCTSTR szDir, bool bFtp);
	void PopulateFilelist(HTREEITEM hItem, LPCTSTR szDir, bool bFtp);
	BOOL PopulateFtpSites(HTREEITEM hItem);

	void InsertFile(LPCTSTR szDir, WIN32_FIND_DATA* pFD, bool bFtp, int iInsertItem = -1);
	BOOL Execute(LPCTSTR lpszDir, LPCTSTR lpszFile);

protected:
	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam, bool& bHandled);
	virtual BOOL OnCreate(LPCREATESTRUCT lpCS, bool& bHandled);
	virtual void OnDestroy(bool& bHandled);
	virtual void OnClose(bool& bHandled);
	virtual LRESULT OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled);

	virtual LRESULT OnNotify(int nCtrlId, LPNMHDR pNMH, bool& bHandled);
		LRESULT OnTreeViewNotify(NMTREEVIEW* pNMTV);
		LRESULT OnListViewNotify(NMLISTVIEW* pNMLV);
		void OnColumnClick(NMLISTVIEW * pLV);

	LRESULT OnBeginDragTree(NMTREEVIEW* pNMTV);
	LRESULT OnBeginDragList(NMLISTVIEW* pNMLV);
	virtual void OnLButtonUp( UINT nFlags, POINT point, bool& bHandled );
	virtual void OnMouseMove( UINT nFlags, POINT point, bool& bHandled );

	HIMAGELIST m_hDragImage;
	bool m_bDragging;
	HWND m_hDropWnd;
	POINT m_ptDropPoint;
	DWORD m_dwDragItem;
	DWORD m_dwDropItem;

//

	void ShowIconBar(bool bShow);
	void OnConnect();
	void OnDisconnect();

public:
	CeMainWnd();
};

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