Click here to Skip to main content
15,881,882 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.1K   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.
// DbView.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include "MainWnd.h"
#include "ftpViewRes.h"

#define CEAPP
#include <CeModule.h>

HINSTANCE g_hInst = NULL;
CeMainWnd g_wnd;

class CeFtpViewApp: public CeAppModule
{
	virtual int OnInitInstance(HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow);
	virtual int OnExitInstance();
}
theApp;


int CeFtpViewApp::OnInitInstance(HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
	LPCTSTR lpszTitle = _T("ftpView");

	INITCOMMONCONTROLSEX initCtrl;
	initCtrl.dwSize = sizeof INITCOMMONCONTROLSEX;
	initCtrl.dwICC = ICC_WIN95_CLASSES | ICC_DATE_CLASSES | ICC_COOL_CLASSES;

	BOOL bRet = InitCommonControlsEx(&initCtrl);

	WORD wVersionRequested = MAKEWORD( 1, 0 );
	WSADATA wsaData;
	int nErr = WSAStartup( wVersionRequested, &wsaData );
	if ( nErr != 0 )
	{
	    // Tell the user that we could not find a usable WinSock DLL.
	    return 1;
	}
 
	//Check if we're running. If it's running then focus on the window
	HWND hGenWnd = FindWindow(WC_CEGENERICWNDCLASS, lpszTitle);
	if (hGenWnd)
	{
		SetForegroundWindow (hGenWnd);    
		return 1;
	}

	g_hInst = m_hInst;

	BOOL bCreated = g_wnd.Create(
		NULL,
		NULL,
		NULL,
		lpszTitle,
		WS_VISIBLE,
		0,
		NULL
	);

	if (! bCreated)
		return 1;

	HICON hSmallIcon = theApp.LoadSmallIcon(IDI_APPICON);
	g_wnd.SetIcon(hSmallIcon, FALSE);

	HICON hLargeIcon = theApp.LoadLargeIcon(IDI_APPICON);
	g_wnd.SetIcon(hLargeIcon, TRUE);

	g_wnd.ShowWindow(nCmdShow);
	g_wnd.UpdateWindow();

	return 0;
}

int CeFtpViewApp::OnExitInstance()
{
	WSACleanup();

	return 0;
}

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