// BeamEx.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "resource.h"
#include "BeamEx.h"
#include "BeamExMain.h"
#include <objbase.h>
HINSTANCE g_hInst = NULL;
CeBeamExMain g_wndMain;
#define CEAPP
#include <CeModule.h>
class CBeamExApp: public CeAppModule
{
virtual int OnInitInstance(HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow);
virtual int OnExitInstance();
}
theApp;
///////////////////////////////////////////////////////////////////////////////
//
// OnInitInstance - entry point
//
///////////////////////////////////////////////////////////////////////////////
int CBeamExApp::OnInitInstance(HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
LPCTSTR lpszTitle = _T("BeamEx");
INITCOMMONCONTROLSEX initCtrl;
initCtrl.dwSize = sizeof INITCOMMONCONTROLSEX;
initCtrl.dwICC = ICC_WIN95_CLASSES | ICC_DATE_CLASSES | ICC_COOL_CLASSES;
BOOL bRet = InitCommonControlsEx(&initCtrl);
#ifdef __PPC__
SHInitExtraControls();
#endif
//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;
#if defined(_WIN32_WCE_POCKETPC)
////////// Setting default main window size
// This technique allows for you to create the main
// window to allow for the postion of a menubar and/or
// the SIP button at the bottom of the screen
RECT rc;
SIPINFO si = {0};
//Set default window creation size info
int iDelta, x = CW_USEDEFAULT, y = CW_USEDEFAULT, cx, cy;
si.cbSize = sizeof(si);
SHSipInfo(SPI_GETSIPINFO, 0, &si, 0);
//Consider the menu at the bottom, please.
iDelta = (si.fdwFlags & SIPF_ON) ? 0 : MENU_HEIGHT;
cx = si.rcVisibleDesktop.right - si.rcVisibleDesktop.left;
cy = si.rcVisibleDesktop.bottom - si.rcVisibleDesktop.top - iDelta;
#endif
BOOL bCreated = g_wndMain.Create(
NULL,
NULL,
&rc,
lpszTitle,
WS_VISIBLE,
0,
NULL
);
if (! bCreated)
return 1;
g_wndMain.ShowWindow(nCmdShow);
g_wndMain.UpdateWindow();
CeDb db;
if (! db.Open(_T("BeamEx Materials")))
{
if (! db.Create(_T("BeamEx Materials"), 0xa55aa55a) || ! db.Open())
{
MessageBox(NULL, _T("Error Creating Materials Database"),
_T("CeDBError"), MB_OK);
}
else
{
CeDbRecord rec;
rec.AddProp(BEAMID_NAME, CEVT_LPWSTR);
rec.AddProp(BEAMID_ELASTICITY, CEVT_LPWSTR);
rec.SetIdVal(BEAMID_NAME, _T("Polycarbonate"));
rec.SetIdVal(BEAMID_ELASTICITY, _T("0.350"));
db.AddRec(rec);
rec.SetIdVal(BEAMID_NAME, _T("Nylon"));
rec.SetIdVal(BEAMID_ELASTICITY, _T("0.400"));
db.AddRec(rec);
rec.SetIdVal(BEAMID_NAME, _T("Polystyrene"));
rec.SetIdVal(BEAMID_ELASTICITY, _T("0.450"));
db.AddRec(rec);
rec.SetIdVal(BEAMID_NAME, _T("White Oak"));
rec.SetIdVal(BEAMID_ELASTICITY, _T("1.800"));
db.AddRec(rec);
rec.SetIdVal(BEAMID_NAME, _T("Douglas Fir"));
rec.SetIdVal(BEAMID_ELASTICITY, _T("1.900"));
db.AddRec(rec);
rec.SetIdVal(BEAMID_NAME, _T("Concrete (medium strength)"));
rec.SetIdVal(BEAMID_ELASTICITY, _T("3.600"));
db.AddRec(rec);
rec.SetIdVal(BEAMID_NAME, _T("Glass (98% silica)"));
rec.SetIdVal(BEAMID_ELASTICITY, _T("9.600"));
db.AddRec(rec);
rec.SetIdVal(BEAMID_NAME, _T("Gray cast Iron"));
rec.SetIdVal(BEAMID_ELASTICITY, _T("10.000"));
db.AddRec(rec);
rec.SetIdVal(BEAMID_NAME, _T("Titanium"));
rec.SetIdVal(BEAMID_ELASTICITY, _T("16.500"));
db.AddRec(rec);
rec.SetIdVal(BEAMID_NAME, _T("Stainless Steel (AISI 302 CRS)"));
rec.SetIdVal(BEAMID_ELASTICITY, _T("28.000"));
db.AddRec(rec);
}
}
return 0;
}
///////////////////////////////////////////////////////////////////////////////
//
// OnExitInstance
//
///////////////////////////////////////////////////////////////////////////////
int CBeamExApp::OnExitInstance()
{
return 0;
}