?? winskel.cpp
字號:
//-------------------------------------------------------------------------
// File: winskel.cpp
//
// Desc: Example code showing how to create a minimal Windows skeleton
//
// Last modified: 31. Dezember 2000
//
// Copyright (c) 1999-2001 Wolfgang Engel wolf@direct3d.net
//--------------------------------------------------------------------------
#include <windows.h>
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
VOID Render();
char szWinName[] = "MyWin"; /* name of window class */
BOOL bActive = TRUE;
int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst,
LPSTR lpszArgs, int nWinMode)
{
HWND hwnd;
MSG msg;
/* Step 1: Define a window class. */
WNDCLASS wcl;
wcl.hInstance = hThisInst; /* handle to this instance */
wcl.lpszClassName = szWinName; /* window class name */
wcl.lpfnWndProc = WndProc; /* window function */
wcl.style = 0; /* default style */
wcl.hIcon = LoadIcon(NULL, MAKEINTRESOURCE( IDI_APPLICATION)); /* icon style */
wcl.hCursor = LoadCursor(NULL, IDC_ARROW); /* cursor style */
wcl.lpszMenuName = NULL; /* no menu */
wcl.cbClsExtra = 0; /* no extra */
wcl.cbWndExtra = 0; /* information needed */
/* Make the window background white. */
wcl.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH) ;
/* Step 2: Register the window class. */
if(!RegisterClass (&wcl))
return 0;
DWORD dwWindowStyle = WS_POPUP | WS_CAPTION;
DWORD dwCreationWidth = 640;
DWORD dwCreationHeight = 480;
RECT rc;
SetRect(&rc, 0, 0, dwCreationWidth, dwCreationHeight);
AdjustWindowRect(&rc, dwWindowStyle, TRUE);
/* Step 3: Now that a window class has been registered,
a window can be created. */
hwnd = CreateWindow(szWinName, /* name of window class */
"FAKE 4", /* title */
dwWindowStyle, /* window style - normal */
CW_USEDEFAULT, /* X coordinate - let Windows decide */
CW_USEDEFAULT, /* y coordinate - let Windows decide */
(rc.right - rc.left), /* */
(rc.bottom - rc.top), /* */
HWND_DESKTOP, /* no parent window */
NULL, /* no menu */
hThisInst, /* handle of this instance of the program */
NULL /* no additional arguments */
);
/* Step 4: Display the window. */
ShowWindow(hwnd, nWinMode);
BOOL bGotMsg;
/* Step 5: Create the message loop. */
while (WM_QUIT != msg.message)
{
if( bActive)
bGotMsg = PeekMessage (&msg, NULL, 0U, 0U, PM_REMOVE);
else
bGotMsg = GetMessage (&msg, NULL, 0U, 0U);
if(bGotMsg)
{
TranslateMessage(&msg); /* allow use of keyboard */
DispatchMessage(&msg); /* return control to Windows */
}
else
{
if(bActive)
Render();
}
}
return msg.wParam;
}
//-----------------------------------------------------------------------------
// Name: WndProc
// Desc: This function is called by Windows and is passed
// messages from the message queue
//-----------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
if (message == WM_KEYDOWN)
{
switch (wParam)
{
case VK_ESCAPE:
PostQuitMessage(WM_QUIT);
break;
case VK_F1:
{
bActive = FALSE;
MessageBox( hwnd, "Here comes your help text",
"Help for FAKE 4", MB_ICONQUESTION|MB_OK | MB_SYSTEMMODAL );
bActive = TRUE;
}
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
}
else
return DefWindowProc(hwnd, message, wParam, lParam);
return 0;
}
//-----------------------------------------------------------------------------
// Name: Render
// Desc: dummy function to show the use of the enhanced skeleton
//-----------------------------------------------------------------------------
VOID Render()
{
};
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -