INSTALL.C
资源名称:Uconvert.zip [点击查看]
上传用户:shijixite
上传日期:2007-01-03
资源大小:108k
文件大小:11k
源码类别:
输入法编程
开发平台:
Visual C++
- /**************************************************************************
- * install.c -- install c_*.nls conversion tables.
- *
- * Steve Firebaugh
- * Microsoft Developer Support
- * Copyright (c) 1992-1997 Microsoft Corporation
- *
- *
- *
- * Note, this module must have UNICODE defined because the registry
- * code will not work without it.
- *
- **************************************************************************/
- #define UNICODE
- #include <windows.h>
- #include <commdlg.h>
- #include <string.h>
- #include <stdio.h>
- #include "uconvert.h"
- #include "install.h"
- /**************************************************************************
- * Global variables.
- **************************************************************************/
- /* This is the registry key that we store conversion table information under. */
- TCHAR NlsRegEntryStr[]=TEXT("SYSTEM\CurrentControlSet\Control\Nls\CodePage");
- /***************************************************************************
- * FUNCTION: InstallTableProc
- *
- * Dialog window procedure for the Install *.nls tables dialog.
- *
- ***************************************************************************/
- LRESULT CALLBACK InstallTableProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- switch (message) {
- /**********************************************************************
- * WM_INITDIALOG
- *
- * Fill dialog with a list of the currently existing tables.
- **********************************************************************/
- case WM_INITDIALOG:
- if (!ListInstalledTables (GetDlgItem (hwnd, DID_LISTBOX), LB_ADDSTRING, FALSE))
- EndDialog (hwnd, FALSE);
- return TRUE;
- break;
- case WM_COMMAND:
- switch (wParam) {
- case IDCANCEL:
- case IDOK:
- EndDialog (hwnd, TRUE);
- break;
- /**********************************************************************
- * WM_COMMAND, BID_ADD
- *
- * Use common dialog, get new *.nls name, and try to install it.
- **********************************************************************/
- case BID_ADD:
- if (GetTableFileNames(hwnd))
- ListInstalledTables (GetDlgItem (hwnd, DID_LISTBOX), LB_ADDSTRING, FALSE);
- break;
- }
- break; /* end WM_COMMAND */
- case WM_SYSCOMMAND:
- if (wParam == SC_CLOSE)
- EndDialog (hwnd, TRUE);
- break; /* end WM_SYSCOMMAND */
- } /* end switch */
- return FALSE;
- }
- /***************************************************************************
- * FUNCTION: GetTableFileNames
- *
- * Throw up a common dialog to the user, and let them search for the *.nls
- * file to install.
- *
- * LIMITATION: Currently only works for one file at a time.
- * Should rewrite to accept multiple files.
- *
- ***************************************************************************/
- int GetTableFileNames (HWND hwnd)
- {
- OPENFILENAME OpenFileName;
- /* buffers for the file names. */
- TCHAR szFile[MAX_PATH],szFileTitle[MAX_PATH];
- TCHAR szFilter[MAX_PATH], buffer[50];
- TCHAR *p;
- /* Build up the correct filter strings for OPENFILENAME structure */
- p = szFilter;
- lstrcpy (buffer,LoadResourceString(IDS_FILE_FILTER_SPEC4));
- lstrcpy (p,buffer);
- p += lstrlen (buffer) +1;
- lstrcpy (buffer,TEXT("*.nls"));
- lstrcpy (p,buffer);
- p += lstrlen (buffer) +1;
- lstrcpy (p,TEXT("