📄 dlg_about.c
字号:
/* * mShell * Copyright 2006, Julien Lecomte * * This software is provided 'as-is', without any express or implied warranty. * In no event will the authors be held liable for any damages arising from the * use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software in a * product, an acknowledgment in the product documentation would be appreciated * but is not required. * 2. Altered source versions must be plainly marked as such, and must not * be misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * $Id: dlg_about.c,v 1.3 2006/04/06 14:45:11 julienlecomte Exp $ */#include "mshell_preconfig.h"#define WIN32_LEAN_AND_MEAN#include <windows.h>#include "mshell_resource.h"#include "mshell.h"INT_PTR CALLBACK AboutDlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam){ switch (msg) { case WM_COMMAND: if (LOWORD(wParam) == IDOK) { EndDialog (hWnd, 0); return TRUE; } return FALSE; case WM_DESTROY: { HANDLE hIco = (HANDLE) SendMessage (GetDlgItem (hWnd, ID_DLG_ICON), STM_SETIMAGE, IMAGE_ICON, 0); if (hIco) DestroyIcon (hIco); return FALSE; } case WM_INITDIALOG: { InitDlgFont (hWnd); InitDlgCenter (hWnd); /* Get version information */ BOOL bSuccess = FALSE; TCHAR szModule[MAX_PATH]; if (GetModuleFileName (NULL, szModule, MAX_PATH)) { DWORD dwLength = GetFileVersionInfoSize (szModule, NULL); if (dwLength) { LPVOID lpBuffer = HeapAlloc (GetProcessHeap (), 0, dwLength); if (lpBuffer) { if (GetFileVersionInfo (szModule, 0, dwLength, lpBuffer)) { VS_FIXEDFILEINFO *lpVSFFI; if (VerQueryValue (lpBuffer, TEXT("\\"), (LPVOID*) &lpVSFFI, NULL)) { TCHAR szBuffer[MAX_PATH]; /* Personal note: What's the use of 4 version numbers ??? * I only see the need for MAJOR/MINOR/REVISION... */ if (lpVSFFI->dwFileVersionLS) sprintf (szBuffer, "Version %d.%d (Rev. %d)", HIWORD(lpVSFFI->dwFileVersionMS), LOWORD(lpVSFFI->dwFileVersionMS), (int) lpVSFFI->dwFileVersionLS); else sprintf (szBuffer, "Version %d.%d", HIWORD(lpVSFFI->dwFileVersionMS), LOWORD(lpVSFFI->dwFileVersionMS)); SendMessage (GetDlgItem (hWnd, ID_DLG_VERS), WM_SETTEXT, 0, (WPARAM) szBuffer); bSuccess = TRUE; } } HeapFree (GetProcessHeap (), 0, lpBuffer); } } } if (bSuccess == FALSE) ShowWindow (GetDlgItem (hWnd, ID_DLG_VERS), SW_HIDE); /* Load license */ bSuccess = FALSE; LPTSTR lpBuffer = HeapAlloc (GetProcessHeap (), 0, 2048 * sizeof(TCHAR)); if (lpBuffer) { if (LoadString (GetModuleHandle (NULL), STRTBL_LICENSE, lpBuffer, 2048)) { SendMessage (GetDlgItem (hWnd, ID_DLG_LIC), WM_SETTEXT, (WPARAM) 0, (LPARAM) lpBuffer); ShowScrollBar (GetDlgItem (hWnd, ID_DLG_LIC), SB_VERT, TRUE); bSuccess = TRUE; } HeapFree (GetProcessHeap (), 0, lpBuffer); } if (bSuccess == FALSE) ShowWindow (GetDlgItem (hWnd, ID_DLG_LIC), SW_HIDE); /* Be nice and show an icon */ HANDLE hIco = LoadImage (GetModuleHandle (NULL), MAKEINTRESOURCE(ICO_MSHELL), IMAGE_ICON, 48, 48, LR_SHARED); SendMessage (GetDlgItem (hWnd, ID_DLG_ICON), STM_SETIMAGE, IMAGE_ICON, (LPARAM) hIco); return TRUE; } case WM_SYSCOMMAND: { if (wParam == SC_CLOSE) { EndDialog (hWnd, 0); return TRUE; } } return FALSE; default: return FALSE; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -