📄 initproc.c
字号:
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (C) 1993-1997 Microsoft Corporation. All Rights Reserved.
//
// MODULE: initproc.c
//
// PURPOSE: Contains application initialization routines.
//
// PLATFORMS: Windows CE
//
// FUNCTIONS:
// InitApplication() - Register window classes
// InitInstance() - Create and display main windows
//
// COMMENTS:
//
//
#include <windows.h>
#include <commctrl.h>
#include <aygshell.h>
#include "globals.h"
#include "resource.h"
//----------------------------------------------------------------------------
// Application global variables
//HINSTANCE g_hInstance = NULL;
//
// FUNCTION: InitApplication(HINSTANCE)
//
// PURPOSE: Registers the application's window class(es).
//
// PARAMETERS:
// hInstance - handle that uniquely identifies this application instance
//
// RETURN VALUE:
// (BOOL) Returns TRUE if the window classes are registered successfully
// Returns FALSE otherwise
//
// COMMENTS:
//
#define DEFBKGDCOLOR (COLOR_WINDOW + 1)
BOOL WINAPI InitApplication(HINSTANCE hInstance)
{
WNDCLASS wc;
// The window class is not registered yet, so we have to fill a
// window class structure with parameters that describe the
// window class.
wc.style = CS_VREDRAW|CS_HREDRAW;
wc.lpfnWndProc = MainWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
#ifdef _WIN_CE_EMULATION
wc.hCursor = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
wc.lpszMenuName = NULL;
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
#else
wc.hCursor = NULL;
wc.lpszMenuName = NULL;
wc.hIcon = NULL;
#endif
wc.hbrBackground = (HBRUSH)DEFBKGDCOLOR;
wc.lpszClassName = TEXT("Win32Generic");
if (!RegisterClass(&wc))
{
ErrorHandler();
return FALSE;
}
g_hwndTreeView = NULL;
return (TRUE);
}
//
// FUNCTION: InitInstance(HINSTANCE, int)
//
// PURPOSE: Creates and displays the application's initial window(s).
//
// PARAMETERS:
// hInstance - handle which uniquely identifies this instance
// nCmdShow - determines the state which the window should be initially
// shown in
//
// RETURN VALUE:
// (BOOL) Returns TRUE if the window(s) are created successfully.
// Returns FALSE otherwise.
//
// COMMENTS:
//
BOOL WINAPI InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hwnd; // temporary window handle
BOOL bStatus = FALSE; // holds return status for function
SIPINFO si = {0};
int iDelta, x = CW_USEDEFAULT, y = CW_USEDEFAULT, cx, cy;
// Save the instance handle in global variable, which will be used in
// many subsequent calls from this application to Windows
g_hInstance = hInstance;
////////// 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 sizd info
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;
hwnd = CreateWindow( TEXT("Win32Generic"), TEXT("Dbview Sample Application"), WS_VISIBLE,
x, y, cx, cy, NULL, NULL, hInstance, NULL);
// If the window was successfully created, make the window visible,
// update its client area, and return "success". If the window
// was not created, return "failure"
if (hwnd)
{
ShowWindow(hwnd, nCmdShow); // Set to visible & paint non-client area
UpdateWindow(hwnd); // Tell window to paint client area
bStatus = TRUE; // Indicate success, default is failure
}
else
{
ErrorHandler();
}
bRemovingProps = FALSE;
return bStatus; // Return status code
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -