|
// DbView.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "DbMainWnd.h"
#include "DbViewRes.h"
//Menu Bar Height
#define MENU_HEIGHT 26
HINSTANCE g_hInst = NULL;
CeDbMainWnd g_wnd;
#define CEAPP
#include <CeModule.h>
class CeDbViewApp: public CeAppModule
{
virtual int OnInitInstance(HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow);
virtual int OnExitInstance();
}
theApp;
///////////////////////////////////////////////////////////////////////////////
//
// OnInitInstance
//
///////////////////////////////////////////////////////////////////////////////
int CeDbViewApp::OnInitInstance(HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
LPCTSTR lpszTitle = _T("DbView");
INITCOMMONCONTROLSEX initCtrl;
initCtrl.dwSize = sizeof INITCOMMONCONTROLSEX;
initCtrl.dwICC = ICC_WIN95_CLASSES | ICC_DATE_CLASSES | ICC_COOL_CLASSES;
BOOL bRet = InitCommonControlsEx(&initCtrl);
//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;
int cx = CW_USEDEFAULT, cy = CW_USEDEFAULT;
#if defined(_WIN32_WCE_POCKETPC) || defined(_WIN32_WCE_PSPC)
////////// 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
//Set default window creation size info
int iDelta;
SIPINFO si = {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_wnd.Create(
NULL,
NULL,
CW_USEDEFAULT, CW_USEDEFAULT, cx, cy,
lpszTitle,
WS_VISIBLE,
0,
NULL
);
if (! bCreated)
return 1;
HICON hSmallIcon = theApp.LoadSmallIcon(IDI_DB);
g_wnd.SetIcon(hSmallIcon, FALSE);
HICON hLargeIcon = theApp.LoadLargeIcon(IDI_DB);
g_wnd.SetIcon(hLargeIcon, TRUE);
g_wnd.ShowWindow(nCmdShow);
g_wnd.UpdateWindow();
return 0;
}
///////////////////////////////////////////////////////////////////////////////
//
// OnExitInstance
//
///////////////////////////////////////////////////////////////////////////////
int CeDbViewApp::OnExitInstance()
{
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.