GBBIG5.CPP
资源名称:gbbig5.rar [点击查看]
上传用户:dyjieshui
上传日期:2021-01-24
资源大小:1427k
文件大小:35k
源码类别:
多国语言处理
开发平台:
Visual C++
- // *****************************************************************************
- // GBBIG5.cpp
- // (C)2000 - YangTze presents
- // *****************************************************************************
- // =============================================================================
- // Head files
- // =============================================================================
- #include "stdafx.h"
- #include "resource.h"
- // =============================================================================
- // Constants
- // =============================================================================
- #define MAX_LOADSTRING 100
- #define WNDWIDTH 500
- #define WNDHEIGHT 308
- // =============================================================================
- // Global Variables
- // =============================================================================
- int ScreenX;
- int ScreenY;
- HINSTANCE hInst;
- TCHAR szTitle[ MAX_LOADSTRING ];
- TCHAR szWindowClass[ MAX_LOADSTRING ];
- HWND hWndVScroll;
- HDC hVDC;
- HBITMAP hVBmp;
- HICON hIconNum[ 16 ];
- HBITMAP hBMPGB;
- HBITMAP hBMPBIG5;
- HCURSOR hMyCursor;
- HCURSOR hSysCursor;
- BOOL bIsGBorBIG5; // TRUE,display GB code; FALSE,display BIG5 code
- HRSRC hTemp;
- DWORD dwDOCSize;
- DWORD dwGBHZLibSize;
- DWORD dwBIG5HZLibSize;
- DWORD dwGBBIG5TABSize;
- HGLOBAL hDOC;
- HGLOBAL hGBHZLib;
- HGLOBAL hBIG5HZLib;
- HGLOBAL hGBBIG5TAB;
- BYTE *pDOC;
- BYTE *pGBHZLib;
- BYTE *pBIG5HZLib;
- BYTE *pGBBIG5TAB;
- BOOL IsDOCOK = FALSE;
- BOOL IsGBHZLibOK = FALSE;
- BOOL IsBIG5HZLibOK = FALSE;
- BOOL IsGBBIG5TABOK = FALSE;
- BYTE xMakeFileType;
- BYTE GBQu;
- BYTE BIG5Qu;
- BYTE CurWei = 0;
- BYTE xxQu = 0;
- BYTE xxWei = 0;
- BOOL bDrawNothing;
- BOOL bPrint = FALSE;
- typedef struct {
- BYTE HasHZ;
- BYTE HZQu;
- BYTE HZWei;
- RECT rc;
- } tagHZRect;
- tagHZRect HZRect[ 12 ][ 16 ];
- BOOL IsLBDown = FALSE;
- BOOL IsInRect;
- RECT CurRc;
- RECT OldRc;
- // =============================================================================
- // Declarations of functions
- // =============================================================================
- ATOM MyRegisterClass( HINSTANCE );
- BOOL InitInstance( HINSTANCE,int );
- LRESULT CALLBACK WndProc( HWND,UINT,WPARAM,LPARAM );
- LRESULT CALLBACK About( HWND,UINT,WPARAM,LPARAM );
- void xMyDraw();
- void xGetHZDot( BYTE xQu,BYTE xWei,BYTE *Dot );
- void xDrawHZ( int x,int y,BYTE *Dot );
- void xDispSectionNum( HWND hWnd );
- void xFindCode( BYTE fQu,BYTE fWei,BOOL GBBIG5 );
- void xExportFile( BYTE MakeFileType );
- void xMakeSetFile( BYTE SetFlag );
- BOOL xPrint( HWND hWnd,HDC hdc );
- // =============================================================================
- // Functions
- // =============================================================================
- // -----------------------------------------------------------------------------
- // FUNCTION : WinMain()
- // PURPOSE :
- // COMMENTS :
- // -----------------------------------------------------------------------------
- int APIENTRY WinMain( HINSTANCE hInstance,HINSTANCE hPrevInstance,
- LPSTR lpCmdLine,int nCmdShow )
- {
- MSG msg;
- HACCEL hAccelTable;
- // TCHAR mm[ 1024 ];
- // GetModuleFileName( ( HMODULE )hInstance,mm,1024 );
- // MessageBox( NULL,mm,"Hello",MB_OK );
- // MessageBox( NULL,GetCommandLine(),"Hello",MB_OK );
- // Get screen metrics
- ScreenX = GetSystemMetrics( SM_CXSCREEN );
- ScreenY = GetSystemMetrics( SM_CYSCREEN );
- // Initialize global strings
- LoadString( hInstance,IDS_APP_TITLE,szTitle,MAX_LOADSTRING );
- LoadString( hInstance,IDC_GBBIG5,szWindowClass,MAX_LOADSTRING );
- MyRegisterClass( hInstance );
- // Perform application initialization
- if( !InitInstance( hInstance,nCmdShow ) ) {
- return FALSE;
- }
- hAccelTable = LoadAccelerators( hInstance,( LPCTSTR )IDC_GBBIG5 );
- // Main message loop
- while( GetMessage( &msg,NULL,0,0 ) ) {
- if( !TranslateAccelerator( msg.hwnd,hAccelTable,&msg ) ) {
- TranslateMessage( &msg );
- DispatchMessage( &msg );
- }
- }
- return msg.wParam;
- }
- // -----------------------------------------------------------------------------
- // FUNCTION : MyRegisterClass()
- // PURPOSE : Registers the window class.
- // COMMENTS :
- // -----------------------------------------------------------------------------
- ATOM MyRegisterClass( HINSTANCE hInstance )
- {
- WNDCLASSEX wcex;
- wcex.cbSize = sizeof( WNDCLASSEX );
- wcex.style = CS_HREDRAW | CS_VREDRAW;
- wcex.lpfnWndProc = ( WNDPROC )WndProc;
- wcex.cbClsExtra = 0;
- wcex.cbWndExtra = 0;
- wcex.hInstance = hInstance;
- wcex.hIcon = LoadIcon( hInstance,( LPCTSTR )"GBBIG5" );
- wcex.hCursor = LoadCursor( NULL,IDC_ARROW );
- wcex.hbrBackground = ( HBRUSH )( COLOR_WINDOW + 1 );
- wcex.lpszMenuName = ( LPCSTR )IDC_GBBIG5;
- wcex.lpszClassName = szWindowClass;
- wcex.hIconSm = LoadIcon( wcex.hInstance,( LPCTSTR )IDI_SMALL );
- return RegisterClassEx( &wcex );
- }
- // -----------------------------------------------------------------------------
- // FUNCTION : InitInstance()
- // PURPOSE : Saves instance handle and creates main window.
- // COMMENTS :
- // -----------------------------------------------------------------------------
- BOOL InitInstance( HINSTANCE hInstance,int nCmdShow )
- {
- HWND hWnd;
- hInst = hInstance;
- hWnd = CreateWindowEx(
- WS_EX_CLIENTEDGE,
- szWindowClass,
- szTitle,
- WS_OVERLAPPED | WS_SYSMENU | WS_VSCROLL,
- ( ScreenX - WNDWIDTH ) / 2,
- ( ScreenY - WNDHEIGHT ) / 2,
- WNDWIDTH,WNDHEIGHT,
- NULL,NULL,hInstance,NULL
- );
- if( !hWnd ) {
- return FALSE;
- }
- hWndVScroll = hWnd;
- SetScrollRange( hWndVScroll,SB_VERT,1,87,TRUE );
- SetScrollPos( hWndVScroll,SB_VERT,GBQu,TRUE );
- ShowWindow( hWnd,nCmdShow );
- UpdateWindow( hWnd );
- return TRUE;
- }
- // -----------------------------------------------------------------------------
- // FUNCTION : WndProc()
- // PURPOSE : Processes messages for the main window.
- // COMMENTS :
- // -----------------------------------------------------------------------------
- LRESULT CALLBACK WndProc( HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam )
- {
- int wmId,wmEvent;
- int nScrollCode,nPos;
- PAINTSTRUCT ps;
- HDC hdc;
- HMENU hMainMenu;
- HMENU hSubMenu;
- BOOL bScroll;
- BOOL bRet;
- POINT pt;
- int i,j;
- TCHAR tmp[ 255 ];
- switch( message ) {
- case WM_CREATE:
- // Create compatiable Device Content
- hdc = GetDC( hWnd );
- hVDC = CreateCompatibleDC( hdc );
- hVBmp = CreateCompatibleBitmap( hdc,WNDWIDTH,WNDHEIGHT );
- SelectObject( hVDC,hVBmp );
- ReleaseDC( hWnd,hdc );
- // Load ICON number
- for( i = 0; i < 16; i ++ ) {
- wsprintf( tmp,"ICON_NUM_%X",i );
- // hIconNum[ i ] = LoadIcon( hInst,tmp );
- hIconNum[ i] = ( HICON )LoadImage( hInst,tmp,IMAGE_ICON,16,16,LR_DEFAULTCOLOR );
- }
- // Load cursor
- hMyCursor = LoadCursor( hInst,"MYCURSOR" );
- hSysCursor = LoadCursor( NULL,IDC_ARROW );
- // Load bitmap
- hBMPGB = LoadBitmap( hInst,"BITMAPGB" );
- hBMPBIG5 = LoadBitmap( hInst,"BITMAPBIG5" );
- // Menu initialization
- bIsGBorBIG5 = TRUE;
- hMainMenu = GetMenu( hWnd );
- hSubMenu = GetSubMenu( hMainMenu,1 );
- CheckMenuItem( hSubMenu,IDM_GBCODE,MF_BYCOMMAND | MF_CHECKED );
- GBQu = 1;
- BIG5Qu = 1;
- // Resource : DOC
- hTemp = FindResourceEx( ( HMODULE )hInst,"DOC","BIG5CODEDOC",MAKELANGID( LANG_NEUTRAL,SUBLANG_NEUTRAL ) );
- if( hTemp ) {
- hDOC = LoadResource( ( HMODULE )hInst,hTemp );
- if( hDOC ) {
- dwDOCSize = SizeofResource( ( HMODULE )hInst,hTemp );
- pDOC = ( BYTE * )LockResource( hDOC );
- IsDOCOK = TRUE;
- }
- }
- // Resource : GBHZLib
- hTemp = FindResourceEx( ( HMODULE )hInst,"HZLIB","GBHZLIB",MAKELANGID( LANG_NEUTRAL,SUBLANG_NEUTRAL ) );
- if( hTemp ) {
- hGBHZLib = LoadResource( ( HMODULE )hInst,hTemp );
- if( hGBHZLib ) {
- dwGBHZLibSize = SizeofResource( ( HMODULE )hInst,hTemp );
- pGBHZLib = ( BYTE * )LockResource( hGBHZLib );
- IsGBHZLibOK = TRUE;
- }
- }
- // Resource : BIG5HZLib
- hTemp = FindResourceEx( ( HMODULE )hInst,"HZLIB","BIG5HZLIB",MAKELANGID( LANG_NEUTRAL,SUBLANG_NEUTRAL ) );
- if( hTemp ) {
- hBIG5HZLib = LoadResource( ( HMODULE )hInst,hTemp );
- if( hBIG5HZLib ) {
- dwBIG5HZLibSize = SizeofResource( ( HMODULE )hInst,hTemp );
- pBIG5HZLib = ( BYTE * )LockResource( hBIG5HZLib );
- IsBIG5HZLibOK = TRUE;
- }
- }
- // Resource : GBBIG5TAB
- hTemp = FindResourceEx( ( HMODULE )hInst,"GBBIG5TAB","GB-BIG5TAB",MAKELANGID( LANG_NEUTRAL,SUBLANG_NEUTRAL ) );
- if( hTemp ) {
- hGBBIG5TAB = LoadResource( ( HMODULE )hInst,hTemp );
- if( hGBBIG5TAB ) {
- dwGBBIG5TABSize = SizeofResource( ( HMODULE )hInst,hTemp );
- pGBBIG5TAB = ( BYTE * )LockResource( hGBBIG5TAB );
- IsGBBIG5TABOK = TRUE;
- }
- }
- break;
- case WM_VSCROLL:
- bScroll = TRUE;;
- nScrollCode = ( int )LOWORD( wParam );
- switch( nScrollCode ) {
- case SB_PAGEDOWN:
- if( bIsGBorBIG5 ) GBQu += 2;
- else BIG5Qu += 2;
- case SB_LINEDOWN:
- // test
- // {
- // char tmp[ 100 ];
- // static int i=0;
- // RECT rc;
- // GetClientRect( hWnd,&rc );
- // wsprintf( tmp,"Hello : %d",i );
- // bScroll = FALSE;
- // i++;
- // ScrollWindow( hWnd,0,-20,NULL,NULL );
- // SetBkMode( hVDC,TRANSPARENT );
- // if( i % 2 ) {
- // SetTextColor( hVDC,RGB( 255,0,0 ) );
- // FillRect(hVDC, &rc, (HBRUSH)GetStockObject( LTGRAY_BRUSH ));
- // }
- // else {
- // SetTextColor( hVDC,RGB( 0,255,0 ) );
- // FillRect(hVDC, &rc, (HBRUSH)GetStockObject( GRAY_BRUSH ));
- // }
- // TextOut( hVDC,0,240,tmp,lstrlen(tmp ) );
- // break;
- // }
- // test
- if( bIsGBorBIG5 ) {
- GBQu ++;
- if( GBQu >= 87 ) GBQu = 87;
- SetScrollPos( hWndVScroll,SB_VERT,GBQu,TRUE );
- }
- else {
- BIG5Qu ++;
- if( BIG5Qu >= 89 ) BIG5Qu = 89;
- SetScrollPos( hWndVScroll,SB_VERT,BIG5Qu,TRUE );
- }
- break;
- case SB_PAGEUP:
- if( bIsGBorBIG5 ) GBQu -= 2;
- else BIG5Qu -= 2;
- case SB_LINEUP:
- if( bIsGBorBIG5 ) {
- GBQu --;
- if( GBQu <= 1 ) GBQu = 1;
- SetScrollPos( hWndVScroll,SB_VERT,GBQu,TRUE );
- }
- else {
- BIG5Qu --;
- if( BIG5Qu <= 1 ) BIG5Qu = 1;
- SetScrollPos( hWndVScroll,SB_VERT,BIG5Qu,TRUE );
- }
- break;
- case SB_THUMBPOSITION:
- nPos = ( short int )HIWORD( wParam );
- if( bIsGBorBIG5 ) GBQu = nPos;
- else BIG5Qu = nPos;
- SetScrollPos( hWndVScroll,SB_VERT,nPos,TRUE );
- break;
- default:
- bScroll = FALSE;
- break;
- }
- if( bScroll ) {
- xDispSectionNum( hWnd );
- xMyDraw();
- InvalidateRect( hWnd,NULL,TRUE );
- }
- break;
- case WM_NCACTIVATE:
- DefWindowProc( hWnd,message,wParam,lParam );
- xDispSectionNum( hWnd );
- return !( ( BOOL)wParam );
- case WM_NCPAINT:
- DefWindowProc( hWnd,message,wParam,lParam );
- xDispSectionNum( hWnd );
- break;
- case WM_COMMAND:
- wmId = LOWORD( wParam );
- wmEvent = HIWORD( wParam );
- // Parse the menu selections
- switch( wmId ) {
- case IDM_GBCODE:
- bIsGBorBIG5 = TRUE;
- hMainMenu = GetMenu( hWnd );
- hSubMenu = GetSubMenu( hMainMenu,1 );
- CheckMenuItem( hSubMenu,IDM_GBCODE,MF_BYCOMMAND | MF_CHECKED );
- CheckMenuItem( hSubMenu,IDM_BIG5CODE,MF_BYCOMMAND | MF_UNCHECKED );
- SetScrollRange( hWndVScroll,SB_VERT,1,87,TRUE );
- SetScrollPos( hWndVScroll,SB_VERT,GBQu,TRUE );
- CurWei = 0;
- xxQu = 0;
- xxWei = 0;
- xDispSectionNum( hWnd );
- xMyDraw();
- InvalidateRect( hWnd,NULL,TRUE );
- break;
- case IDM_BIG5CODE:
- bIsGBorBIG5 = FALSE;
- hMainMenu = GetMenu( hWnd );
- hSubMenu = GetSubMenu( hMainMenu,1 );
- CheckMenuItem( hSubMenu,IDM_GBCODE,MF_BYCOMMAND | MF_UNCHECKED );
- CheckMenuItem( hSubMenu,IDM_BIG5CODE,MF_BYCOMMAND | MF_CHECKED );
- SetScrollRange( hWndVScroll,SB_VERT,1,89,TRUE );
- SetScrollPos( hWndVScroll,SB_VERT,BIG5Qu,TRUE );
- CurWei = 0;
- xxQu = 0;
- xxWei = 0;
- xDispSectionNum( hWnd );
- xMyDraw();
- InvalidateRect( hWnd,NULL,TRUE );
- break;
- case IDM_MAKEDOCFILE:
- xMakeFileType = 0;
- xExportFile( xMakeFileType );
- break;
- case IDM_MAKEGBHZLIBFILE:
- xMakeFileType = 1;
- xExportFile( xMakeFileType );
- break;
- case IDM_MAKEBIG5HZLIBFILE:
- xMakeFileType = 2;
- xExportFile( xMakeFileType );
- break;
- case IDM_MAKEGBBIG5TABFILE:
- xMakeFileType = 3;
- xExportFile( xMakeFileType );
- break;
- case IDM_MAKEGBSET:
- xMakeSetFile( 0 );
- break;
- case IDM_MAKEBIG5SET:
- xMakeSetFile( 1 );
- break;
- case IDM_PRINT:
- SetWindowText( hWnd,"Now printing..." );
- bPrint = TRUE;
- bRet = xPrint( hWnd,hVDC );
- if( bRet )
- MessageBox( hWnd,"Printing OK!",szTitle,MB_OK | MB_ICONINFORMATION );
- else
- MessageBox( hWnd,"Printing failure!",szTitle,MB_OK | MB_ICONINFORMATION );
- bPrint = FALSE;
- xMyDraw();
- SetWindowText( hWnd,szTitle );
- break;
- case IDM_ABOUT:
- DialogBox( hInst,( LPCTSTR )IDD_ABOUTBOX,hWnd,( DLGPROC )About );
- break;
- case IDM_EXIT:
- DestroyWindow( hWnd );
- break;
- default:
- return DefWindowProc( hWnd,message,wParam,lParam );
- }
- break;
- case WM_SIZE:
- xMyDraw();
- InvalidateRect( hWnd,NULL,TRUE );
- break;
- case WM_MOUSEMOVE:
- pt.x = LOWORD( lParam );
- pt.y = HIWORD( lParam );
- SetCursor( hSysCursor );
- IsInRect = FALSE;
- for( i = 0; i < 12; i ++ ) {
- for( j = 0; j < 16; j ++ ) {
- if( PtInRect( &HZRect[ i ][ j ].rc,pt ) ) {
- IsInRect = TRUE;
- CurRc.left = HZRect[ i ][ j ].rc.left;
- CurRc.top = HZRect[ i ][ j ].rc.top;
- CurRc.right = HZRect[ i ][ j ].rc.right;
- CurRc.bottom = HZRect[ i ][ j ].rc.bottom;
- if( HZRect[ i ][ j ].HasHZ ) {
- CurWei = HZRect[ i ][ j ].HZWei;
- SetCursor( hMyCursor );
- xFindCode( HZRect[ i ][ j ].HZQu,CurWei,bIsGBorBIG5 );
- }
- else {
- CurWei = 0;
- }
- xDispSectionNum( hWnd );
- }
- }
- }
- break;
- case WM_LBUTTONDOWN:
- if( !IsInRect ) break;
- IsLBDown = TRUE;
- SetCapture( hWnd );
- hdc = GetDC( hWnd );
- SetROP2( hdc,R2_NOT );
- OldRc.left = CurRc.left;
- OldRc.top = CurRc.top;
- OldRc.right = CurRc.right;
- OldRc.bottom = CurRc.bottom;
- MoveToEx( hdc,OldRc.left,0,NULL );
- LineTo( hdc,OldRc.left,OldRc./*bottom*/top );
- MoveToEx( hdc,0,OldRc.top,NULL );
- LineTo( hdc,OldRc./*right*/left,OldRc.top );
- MoveToEx( hdc,OldRc.right,0,NULL );
- LineTo( hdc,OldRc.right,OldRc.bottom );
- MoveToEx( hdc,0,OldRc.bottom,NULL );
- LineTo( hdc,OldRc.right,OldRc.bottom );
- ReleaseDC( hWnd,hdc );
- break;
- case WM_LBUTTONUP:
- if( !IsLBDown ) break;
- IsLBDown = FALSE;
- ReleaseCapture();
- hdc = GetDC( hWnd );
- SetROP2( hdc,R2_NOT );
- MoveToEx( hdc,OldRc.left,0,NULL );
- LineTo( hdc,OldRc.left,OldRc.top );
- MoveToEx( hdc,0,OldRc.top,NULL );
- LineTo( hdc,OldRc.left,OldRc.top );
- MoveToEx( hdc,OldRc.right,0,NULL );
- LineTo( hdc,OldRc.right,OldRc.bottom );
- MoveToEx( hdc,0,OldRc.bottom,NULL );
- LineTo( hdc,OldRc.right,OldRc.bottom );
- ReleaseDC( hWnd,hdc );
- break;
- case WM_PAINT:
- hdc = BeginPaint( hWnd,&ps );
- BitBlt(
- hdc,
- ps.rcPaint.left,ps.rcPaint.top,
- ps.rcPaint.right,ps.rcPaint.bottom,
- hVDC,
- ps.rcPaint.left,ps.rcPaint.top,
- SRCCOPY
- );
- EndPaint( hWnd,&ps );
- break;
- case WM_DESTROY:
- if( hVDC ) DeleteDC( hVDC );
- if( hVBmp ) DeleteObject( hVBmp );
- PostQuitMessage( 0 );
- break;
- default:
- return DefWindowProc( hWnd,message,wParam,lParam );
- }
- return 0;
- }
- // -----------------------------------------------------------------------------
- // FUNCTION : xMyDraw()
- // PURPOSE : Drawing client area in the compatiable DC.
- // COMMENTS :
- // -----------------------------------------------------------------------------
- void xMyDraw()
- {
- HDC hmemDC;
- BYTE nQu,nWei;
- int nRowNum;
- int i,j,k;
- BYTE HZDot[ 32 ];
- // Clear DC
- SelectObject( hVDC,GetStockObject( WHITE_BRUSH ) );
- PatBlt( hVDC,0,0,WNDWIDTH,WNDHEIGHT,PATCOPY );
- // Draw GB or BIG5 bitmap
- hmemDC = CreateCompatibleDC( hVDC );
- if( bIsGBorBIG5 ) SelectObject( hmemDC,hBMPGB );
- else SelectObject( hmemDC,hBMPBIG5 );
- BitBlt( hVDC,8,1,32,32,hmemDC,0,0,SRCCOPY );
- DeleteDC( hmemDC );
- // Draw horization line & icon number
- MoveToEx( hVDC,0,0,NULL );
- LineTo( hVDC,( 16 + 2 ) * 27 - 15,0 );
- MoveToEx( hVDC,0,18,NULL );
- LineTo( hVDC,( 16 + 2 ) * 27 - 15,18 );
- MoveToEx( hVDC,0,13 * 20 - 1,NULL );
- LineTo( hVDC,( 16 + 2 ) * 27 - 15,13 * 20 - 1 );
- for( i = 0; i < 16; i ++ ) {
- DrawIconEx( hVDC,i * ( 16 + 10 ) + 60 ,1,hIconNum[ i ],16,16,0,NULL,DI_NORMAL );
- }
- // Draw vertical line & icon number
- MoveToEx( hVDC,0,0,NULL );
- LineTo( hVDC,0,13 * 20 );
- MoveToEx( hVDC,( 16 + 2 ) * 3,0,NULL );
- LineTo( hVDC,( 16 + 2 ) * 3,13 * 20 );
- MoveToEx( hVDC,( 16 + 2 ) * 27 - 15,0,NULL );
- LineTo( hVDC,( 16 + 2 ) * 27 - 15,13 * 20 );
- if( bIsGBorBIG5 ) nQu = 0xA0 + GBQu;
- else nQu = 0xA0 + BIG5Qu;
- nRowNum = 12;
- for( j = 0; j < nRowNum; j ++ ) {
- DrawIconEx( hVDC,0 * ( 16 + 2 ) + 1, 20 * j + 20,hIconNum[ ( ( nQu & 0xf0 ) >> 4 ) ],16,16,0,NULL,DI_NORMAL );
- DrawIconEx( hVDC,1 * ( 16 + 2 ) + 1, 20 * j + 20,hIconNum[ ( nQu & 0x0f ) ],16,16,0,NULL,DI_NORMAL );
- DrawIconEx( hVDC,2 * ( 16 + 2 ) + 1, 20 * j + 20,hIconNum[ j + 4 ],16,16,0,NULL,DI_NORMAL );
- }
- // Draw HZ
- for( k = 0; k < nRowNum; k ++ ) {
- for( i = 0; i < 16; i ++ ) {
- nWei = 0x40 + k * 16 + i;
- memset( HZDot,0x00,32 );
- xGetHZDot( nQu,nWei,HZDot );
- HZRect[ k ][ i ].HasHZ = !bDrawNothing;
- HZRect[ k ][ i ].HZQu = nQu;
- HZRect[ k ][ i ].HZWei = nWei;
- HZRect[ k ][ i ].rc.left = i * ( 16 + 10 ) + 60;
- HZRect[ k ][ i ].rc.right = i * ( 16 + 10 ) + 60 + 16;
- HZRect[ k ][ i ].rc.top = ( k + 1 ) * 20;
- HZRect[ k ][ i ].rc.bottom = ( k + 1 ) * 20 + 16;
- xDrawHZ( i * ( 16 + 10 ) + 60,( k + 1 ) * 20,HZDot );
- }
- }
- }
- // -----------------------------------------------------------------------------
- // FUNCTION : xGetHZDot()
- // PURPOSE : Get the HZ dot matrix from HZLib resource.
- // COMMENTS :
- // -----------------------------------------------------------------------------
- void xGetHZDot( BYTE xQu,BYTE xWei,BYTE *Dot )
- {
- DWORD offset;
- BYTE *ptr = NULL;
- int j;
- // For printing
- if( xQu > 0xf9 ) {
- bDrawNothing = TRUE;
- for( j = 0; j < 32; j ++ ) {
- Dot[ j ] = 0xff;
- }
- return;
- }
- if( bIsGBorBIG5 ) {
- if( xWei < 0xa1 || xWei > 0xfe ) {
- ptr = NULL;
- }
- else {
- ptr = pGBHZLib;
- offset = ( xQu - 0xa1 ) * 94 * 32 + ( xWei - 0xa1 ) * 32;
- }
- }
- else {
- ptr = pBIG5HZLib;
- if( xWei >= 0x40 && xWei <= 0x7e )
- offset = ( xQu - 0xa1 ) * 157 * 32 + ( xWei - 0x40 ) * 32;
- else if( xWei >= 0xa1 && xWei <= 0xfe )
- offset = ( xQu - 0xa1 ) * 157 * 32 + 63 * 32 + ( xWei - 0xa1 ) * 32;
- else
- ptr = NULL;
- }
- if( ptr ) {
- bDrawNothing = FALSE;
- for( j = 0; j < 32; j ++ ) {
- Dot[ j ] = *( ptr + offset + j );
- if( !bIsGBorBIG5 ) Dot[ j ] = Dot[ j ] ^ 0xff;
- }
- }
- else {
- bDrawNothing = TRUE;
- for( j = 0; j < 32; j ++ ) {
- Dot[ j ] = 0xff;
- }
- }
- }
- // -----------------------------------------------------------------------------
- // FUNCTION : DrawHZ()
- // PURPOSE : Draw HZ in the compatiable DC.
- // COMMENTS :
- // -----------------------------------------------------------------------------
- void xDrawHZ( int x,int y,BYTE *Dot )
- {
- int i,j;
- int nCol,nRow;
- WORD wDot;
- WORD wMask;
- BYTE b1,b2;
- COLORREF cr;
- if( bDrawNothing ) cr = RGB( 192,192,192 );
- else {
- cr = RGB( 0,192,0 );
- if( bPrint ) cr = RGB( 0,0,0 );
- }
- nRow = y;
- for( i = 0; i < 32; i ++ ) {
- b1 = *( Dot + i + 0 );
- b2 = *( Dot + i + 1 );
- i ++;
- wDot = MAKEWORD( b2,b1 );
- nCol = x;
- wMask = 0x8000;
- for( j = 0; j < 16; j ++ ) {
- if( wDot & wMask ) {
- SetPixel( hVDC,nCol,nRow,cr );
- }
- //else SetPixel( hVDC,nCol,nRow,RGB( 0,128,0 ) );
- wMask >>= 1;
- nCol ++;
- }
- nRow ++;
- }
- }
- // -----------------------------------------------------------------------------
- // FUNCTION : xDispSectionNum()
- // PURPOSE : Display the "Qu/total Qu -> GB : XXXX BIG5 : XXXX" message in
- // : menu bar.
- // COMMENTS :
- // -----------------------------------------------------------------------------
- void xDispSectionNum( HWND hWnd )
- {
- TCHAR str[ 255 ];
- HDC hdc;
- BYTE yQu;
- BYTE Page;
- BYTE Pages;
- if( bIsGBorBIG5 ) {
- yQu = GBQu;
- Pages = 87 / 3;
- }
- else {
- yQu = BIG5Qu;
- Pages = 89 / 3 + 1;
- }
- if( yQu % 3 == 0 ) Page = yQu / 3;
- else Page = yQu / 3 + 1;
- if( CurWei == 0 ) {
- if( bIsGBorBIG5 ) {
- wsprintf( str," %02d#87 -> GB : %02XXX BIG5 : XXXX P.%02d/%02d ",yQu,yQu + 0xa0,Page,Pages );
- }
- else {
- wsprintf( str," %02d#89 -> GB : XXXX BIG5 : %02XXX P.%02d/%02d ",yQu,yQu + 0xa0,Page,Pages );
- }
- }
- else {
- if( bIsGBorBIG5 ) {
- if( xxQu == 0xff && xxWei == 0xff ) {
- wsprintf( str," %02d#87 -> GB : %02X%02X BIG5 : XXXX P.%02d/%02d ",yQu,yQu + 0xa0,CurWei,Page,Pages );
- }
- else {
- wsprintf( str," %02d#87 -> GB : %02X%02X BIG5 : %02X%02X P.%02d/%02d ",yQu,yQu + 0xa0,CurWei,xxQu,xxWei,Page,Pages );
- }
- }
- else {
- if( xxQu == 0xff && xxWei == 0xff ) {
- wsprintf( str," %02d#89 -> GB : XXXX BIG5 : %02X%02X P.%02d/%02d ",yQu,yQu + 0xa0,CurWei,Page,Pages );
- }
- else {
- wsprintf( str," %02d#89 -> GB : %02X%02X BIG5 : %02X%02X P.%02d/%02d ",yQu,xxQu,xxWei,yQu + 0xa0,CurWei,Page,Pages );
- }
- }
- }
- hdc = GetWindowDC( hWnd );
- SetTextColor( hdc,RGB( 0,255,0 ) );
- SetBkColor( hdc,RGB( 0,0,0 ) );
- TextOut( hdc,180,24,str,lstrlen( str ) );
- ReleaseDC( hWnd,hdc );
- }
- // -----------------------------------------------------------------------------
- // FUNCTION : xFindCode()
- // PURPOSE : Find GB/BIG5 code int the GB-BIG5 table.
- // COMMENTS :
- // -----------------------------------------------------------------------------
- void xFindCode( BYTE fQu,BYTE fWei,BOOL GBBIG5 )
- {
- BYTE *ptr;
- DWORD TableLen;
- DWORD i;
- BOOL bFind;
- bFind = FALSE;
- if( !GBBIG5 ) {
- ptr = pGBBIG5TAB;
- TableLen = 0x4000;
- }
- else {
- ptr = pGBBIG5TAB + 0x4508;
- TableLen = 0x6e08;
- }
- for( i = 0; i < TableLen; i ++ ) {
- if( ( fQu == *( ptr + i ) ) && ( fWei == *( ptr + i + 1 ) ) ) {
- bFind = TRUE;
- break;
- }
- i ++;
- }
- if( !bFind ) {
- xxQu = 0xff;
- xxWei = 0xff;
- return;
- }
- if( !GBBIG5 ) {
- xxWei = ( BYTE )( ( i / 2 ) % 94 + 0xa1 );
- xxQu = ( BYTE )( ( i / 2 ) / 94 + 0xa1 );
- }
- else {
- xxWei = ( BYTE )( ( i / 2 ) % 157 );
- if( xxWei < 64 ) xxWei += 0x40;
- else xxWei = xxWei - 63 + 0xa1;
- xxQu = ( BYTE )( ( i / 2 ) / 157 + 0xa1 );
- }
- }
- // -----------------------------------------------------------------------------
- // FUNCTION : About()
- // PURPOSE : Mesage handler for about box.
- // COMMENTS :
- // -----------------------------------------------------------------------------
- LRESULT CALLBACK About( HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam )
- {
- switch( message ) {
- case WM_INITDIALOG:
- SetWindowText( hDlg,szTitle );
- return TRUE;
- case WM_COMMAND:
- if( LOWORD( wParam ) == IDOK || LOWORD( wParam ) == IDCANCEL ) {
- EndDialog( hDlg,LOWORD( wParam ) );
- return TRUE;
- }
- break;
- }
- return FALSE;
- }
- // -----------------------------------------------------------------------------
- // FUNCTION : xExportFile()
- // PURPOSE : Dump the resource to disk file.
- // COMMENTS :
- // -----------------------------------------------------------------------------
- void xExportFile( BYTE MakeFileType )
- {
- BYTE *ptr;
- DWORD dwFileSize;
- DWORD dwWrittenBytes;
- BOOL IsOK;
- OPENFILENAME ofn;
- TCHAR TheFileName[ 1024 * 2 ];
- TCHAR TheTitle[ 100 ];
- HANDLE hFile;
- TheFileName[ 0 ] = 0x00;
- switch( MakeFileType ) {
- case 0:
- IsOK = IsDOCOK;
- ptr = pDOC;
- dwFileSize = dwDOCSize;
- lstrcpy( TheTitle,"Export BIG5 code file" );
- break;
- case 1:
- IsOK = IsGBHZLibOK;
- ptr = pGBHZLib;
- dwFileSize = dwGBHZLibSize;
- lstrcpy( TheTitle,"Export GB HZLib(16x16) file" );
- break;
- case 2:
- IsOK = IsBIG5HZLibOK;
- ptr = pBIG5HZLib;
- dwFileSize = dwBIG5HZLibSize;
- lstrcpy( TheTitle,"Export BIG5 HZLib(16x16) file" );
- break;
- case 3:
- IsOK = IsGBBIG5TABOK;
- ptr = pGBBIG5TAB;
- dwFileSize = dwGBBIG5TABSize;
- lstrcpy( TheTitle,"Export GB-BIG5 index table file" );
- break;
- default:
- return;
- }
- if( !IsOK ) {
- MessageBox(
- NULL,
- "The data for the specified file is not OK!",
- szTitle,MB_OK | MB_ICONINFORMATION
- );
- return;
- }
- ofn.lStructSize = sizeof( OPENFILENAME );
- ofn.hwndOwner = NULL;
- ofn.hInstance = hInst;
- ofn.lpstrFilter = "All files *.* ";
- ofn.lpstrCustomFilter =NULL;
- ofn.nMaxCustFilter = 0;
- ofn.nFilterIndex = 0;
- ofn.lpstrFile = TheFileName;
- ofn.nMaxFile = 1024 * 2;
- ofn.lpstrFileTitle = NULL;
- ofn.nMaxFileTitle = 0;
- ofn.lpstrInitialDir = NULL;
- ofn.lpstrTitle = TheTitle;
- ofn.Flags = OFN_HIDEREADONLY | OFN_LONGNAMES | OFN_OVERWRITEPROMPT;
- ofn.nFileOffset = 0;
- ofn.nFileExtension = 0;
- ofn.lpstrDefExt = NULL;
- ofn.lCustData = 0;
- ofn.lpfnHook =NULL ;
- ofn.lpTemplateName = NULL;
- if( !GetSaveFileName( &ofn ) ) {
- MessageBox(
- NULL,"Fail to export file!",
- szTitle,MB_OK | MB_ICONINFORMATION
- );
- return;
- }
- hFile = CreateFile(
- TheFileName,
- GENERIC_WRITE,
- 0,
- NULL,
- CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL,
- NULL
- );
- if( hFile == INVALID_HANDLE_VALUE ) {
- MessageBox(
- NULL,"Fail to export file!",
- szTitle,MB_OK | MB_ICONINFORMATION
- );
- return;
- }
- if( !WriteFile( hFile,ptr,dwFileSize,&dwWrittenBytes,NULL ) ) {
- CloseHandle( hFile );
- MessageBox(
- NULL,"Fail to export file!",
- szTitle,MB_OK | MB_ICONINFORMATION
- );
- return;
- }
- if( dwWrittenBytes != dwFileSize ) {
- CloseHandle( hFile );
- MessageBox(
- NULL,"Fail to export file!",
- szTitle,MB_OK | MB_ICONINFORMATION
- );
- return;
- }
- lstrcat( TheTitle," OK!" );
- MessageBox(
- NULL,TheTitle,
- szTitle,MB_OK | MB_ICONINFORMATION
- );
- CloseHandle( hFile );
- }
- // -----------------------------------------------------------------------------
- // FUNCTION : xMakeSetFile()
- // PURPOSE : Make the GB/BIG5 character set text file.
- // COMMENTS :
- // -----------------------------------------------------------------------------
- void xMakeSetFile( BYTE SetFlag )
- {
- DWORD dwSize;
- DWORD dwWrittenBytes;
- OPENFILENAME ofn;
- TCHAR TheFileName[ 1024 * 2 ];
- TCHAR TheTitle[ 100 ];
- HANDLE hFile;
- BYTE nQu,nWei;
- BYTE nRowNum;
- BYTE nQuNum = 0;
- BYTE HexSet[ 16 ] = {
- '0','1','2','3','4','5','6','7',
- '8','9','A','B','C','D','E','F'
- };
- #define LB 56
- char SetBuf[ 15 ][ LB ];
- int i,j,k,l;
- TheFileName[ 0 ] = 0x00;
- switch( SetFlag ) {
- case 0:
- nQuNum = 87;
- lstrcpy( TheTitle,"Make GB character set file" );
- break;
- case 1:
- nQuNum = 89;
- lstrcpy( TheTitle,"Make BIG5 character set file" );
- break;
- default:
- return;
- }
- ofn.lStructSize = sizeof( OPENFILENAME );
- ofn.hwndOwner = NULL;
- ofn.hInstance = hInst;
- ofn.lpstrFilter = "All files *.* ";
- ofn.lpstrCustomFilter =NULL;
- ofn.nMaxCustFilter = 0;
- ofn.nFilterIndex = 0;
- ofn.lpstrFile = TheFileName;
- ofn.nMaxFile = 1024 * 2;
- ofn.lpstrFileTitle = NULL;
- ofn.nMaxFileTitle = 0;
- ofn.lpstrInitialDir = NULL;
- ofn.lpstrTitle = TheTitle;
- ofn.Flags = OFN_HIDEREADONLY | OFN_LONGNAMES | OFN_OVERWRITEPROMPT;
- ofn.nFileOffset = 0;
- ofn.nFileExtension = 0;
- ofn.lpstrDefExt = NULL;
- ofn.lCustData = 0;
- ofn.lpfnHook =NULL ;
- ofn.lpTemplateName = NULL;
- if( !GetSaveFileName( &ofn ) ) {
- MessageBox(
- NULL,"Fail to make file!",
- szTitle,MB_OK | MB_ICONINFORMATION
- );
- return;
- }
- hFile = CreateFile(
- TheFileName,
- GENERIC_WRITE,
- 0,
- NULL,
- CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL,
- NULL
- );
- if( hFile == INVALID_HANDLE_VALUE ) {
- MessageBox(
- NULL,"Fail to make file!",
- szTitle,MB_OK | MB_ICONINFORMATION
- );
- return;
- }
- nQu = 0xA0;
- if( !SetFlag ) nRowNum = 6;
- else nRowNum = 12;
- // 1 2 3 4 5
- // 01234567890123456789012345678901234567890123456789012345
- lstrcpy( SetBuf[ 0 ]," | 0 1 2 3 4 5 6 7 8 9 A B C D E F |" );
- lstrcpy( SetBuf[ 1 ],"----+------------------------------------------------|" );
- lstrcpy( SetBuf[ 8 ],"----+------------------------------------------------|" );
- lstrcpy( SetBuf[ 14 ],"----+------------------------------------------------|" );
- SetBuf[ 0 ][ LB - 2 ] = 0x0d;
- SetBuf[ 0 ][ LB - 1 ] = 0x0a;
- SetBuf[ 1 ][ LB - 2 ] = 0x0d;
- SetBuf[ 1 ][ LB - 1 ] = 0x0a;
- SetBuf[ 8 ][ LB - 2 ] = 0x0d;
- SetBuf[ 8 ][ LB - 1 ] = 0x0a;
- SetBuf[ 14 ][ LB - 2 ] = 0x0d;
- SetBuf[ 14 ][ LB - 1 ] = 0x0a;
- for( l = 1; l <= nQuNum; l ++ ) {
- wsprintf( SetBuf[ 0 ]," %02d",l );
- SetBuf[ 0 ][ 3 ] = 0x20;
- for( j = 2; j < 14; j ++ ) {
- ZeroMemory( SetBuf[ j ],LB );
- if( !SetFlag ) {
- if( j == 7 ) break;
- }
- }
- for( j = 0; j < nRowNum; j ++ ) {
- SetBuf[ j + 2 ][ 0 ] = HexSet[ ( ( nQu + l ) & 0xf0 ) >> 4 ];
- SetBuf[ j + 2 ][ 1 ] = HexSet[ ( nQu + l ) & 0x0f ];
- SetBuf[ j + 2 ][ 2 ] = 0x20;
- if( !SetFlag ) SetBuf[ j + 2 ][ 3 ] = HexSet[ j + 10 ];
- else SetBuf[ j + 2 ][ 3 ] = HexSet[ j + 4 ];
- SetBuf[ j + 2 ][ 4 ] = '|';
- }
- for( k = 0; k < nRowNum; k ++ ) {
- j = 5;
- for( i = 0; i < 16; i ++ ) {
- if( !SetFlag ) nWei = 0xA0 + k * 16 + i;
- else nWei = 0x40 + k * 16 + i;
- if( !SetFlag ) {
- if( nWei > 0xA0 && nWei < 0xff ) {
- SetBuf[ k + 2 ][ j ++ ] = 0x20;
- SetBuf[ k + 2 ][ j ++ ] = nQu + l;
- SetBuf[ k + 2 ][ j ++ ] = nWei;
- }
- else {
- SetBuf[ k + 2 ][ j ++ ] = 0x20;
- SetBuf[ k + 2 ][ j ++ ] = 0x20;
- SetBuf[ k + 2 ][ j ++ ] = 0x20;
- }
- }
- else {
- if( nWei < 0x7f || ( nWei > 0xA0 && nWei < 0xff ) ) {
- SetBuf[ k + 2 ][ j ++ ] = 0x20;
- SetBuf[ k + 2 ][ j ++ ] = nQu + l;
- SetBuf[ k + 2 ][ j ++ ] = nWei;
- }
- else {
- SetBuf[ k + 2 ][ j ++ ] = 0x20;
- SetBuf[ k + 2 ][ j ++ ] = 0x20;
- SetBuf[ k + 2 ][ j ++ ] = 0x20;
- }
- }
- }
- SetBuf[ k + 2 ][ j ++ ] = '|';
- SetBuf[ k + 2 ][ j ++ ] = 0x0d;
- SetBuf[ k + 2 ][ j ] = 0x0a;
- }
- if( !SetFlag ) dwSize = 9 * LB;
- else dwSize = 15 * LB;
- if( !WriteFile( hFile,( BYTE * )SetBuf,dwSize,&dwWrittenBytes,NULL ) ) {
- CloseHandle( hFile );
- MessageBox(
- NULL,"Fail to make file!",
- szTitle,MB_OK | MB_ICONINFORMATION
- );
- return;
- }
- if( dwWrittenBytes != dwSize ) {
- CloseHandle( hFile );
- MessageBox(
- NULL,"Fail to make file!",
- szTitle,MB_OK | MB_ICONINFORMATION
- );
- return;
- }
- }
- lstrcat( TheTitle," OK!" );
- MessageBox(
- NULL,TheTitle,
- szTitle,MB_OK | MB_ICONINFORMATION
- );
- CloseHandle( hFile );
- }
- // -----------------------------------------------------------------------------
- // FUNCTION : xPrint()
- // PURPOSE : Print the current section.
- // COMMENTS :
- // -----------------------------------------------------------------------------
- BOOL xPrint( HWND hWnd,HDC hdc )
- {
- PRINTDLG pd;
- DOCINFO di;
- int nRet;
- int cWidthPels,cHeightPels;
- int xLeft,yTop;
- float fLogPelsX1,fLogPelsX2;
- float fLogPelsY1,fLogPelsY2;
- float fScaleX,fScaleY;
- RECT rc;
- BYTE oldQu,CurQu,pQu;
- BYTE Pages,CurPages;
- char tmp[ 255 ];
- if( bIsGBorBIG5 ) {
- oldQu = GBQu;
- Pages = 87 / 3;
- }
- else {
- oldQu = BIG5Qu;
- Pages = 89 / 3 + 1;
- }
- pd.lStructSize = sizeof( PRINTDLG );
- pd.hwndOwner = NULL;
- pd.hDevMode = NULL;
- pd.hDevNames = NULL;
- pd.hDC = NULL;
- pd.Flags = PD_RETURNDC | PD_NOSELECTION | PD_DISABLEPRINTTOFILE;
- pd.nFromPage = 1;
- pd.nToPage = Pages;
- pd.nMinPage = 1;
- pd.nMaxPage = Pages;
- pd.nCopies = 1;
- pd.hInstance = NULL;
- pd.lCustData = 0;
- pd.lpfnPrintHook = NULL;
- pd.lpfnSetupHook = NULL;
- pd.lpPrintTemplateName = NULL;
- pd.lpSetupTemplateName = NULL;
- pd.hPrintTemplate = NULL;
- pd.hSetupTemplate = NULL;
- if( !PrintDlg( &pd ) ) return FALSE;
- if( !( GetDeviceCaps( pd.hDC,RASTERCAPS ) & RC_BITBLT ) ) {
- DeleteDC( pd.hDC );
- return FALSE;
- }
- GetClientRect( hWnd,&rc );
- di.cbSize = sizeof( DOCINFO );
- di.lpszDocName = "Print GB/BIG5 character set";
- di.lpszOutput = NULL;
- di.lpszDatatype = NULL;
- di.fwType = 0;
- nRet = StartDoc( pd.hDC,&di );
- if( nRet <= 0 ) {
- DeleteDC( pd.hDC );
- return FALSE;
- }
- fLogPelsX1 = ( float )GetDeviceCaps( hVDC,LOGPIXELSX );
- fLogPelsY1 = ( float )GetDeviceCaps( hVDC,LOGPIXELSY );
- fLogPelsX2 = ( float )GetDeviceCaps( pd.hDC,LOGPIXELSX );
- fLogPelsY2 = ( float )GetDeviceCaps( pd.hDC,LOGPIXELSY );
- if( fLogPelsX1 > fLogPelsX2 ) fScaleX = ( fLogPelsX1 / fLogPelsX2 );
- else fScaleX = ( fLogPelsX2 / fLogPelsX1 );
- if( fLogPelsY1 > fLogPelsY2 ) fScaleY = ( fLogPelsY1 / fLogPelsY2 );
- else fScaleY = ( fLogPelsY2 / fLogPelsY1 );
- cWidthPels = GetDeviceCaps( pd.hDC,HORZRES );
- cHeightPels = GetDeviceCaps( pd.hDC,VERTRES );
- xLeft = ( ( cWidthPels / 2 ) - ( ( int )( ( ( float )rc.right ) * fScaleX ) ) / 2 );
- yTop = ( ( cHeightPels / 2 ) - ( ( int )( ( ( float )rc.bottom ) * fScaleY * 3 ) ) / 2 );
- CurQu = ( pd.nFromPage - 1 ) * 3;
- for( CurPages = pd.nFromPage - 1; CurPages < pd.nToPage; CurPages ++ ) {
- wsprintf( tmp,"Printing page %d of %d...",CurPages + 1,pd.nToPage );
- SetWindowText( hWnd,tmp );
- nRet = StartPage( pd.hDC );
- if( nRet <= 0 ) {
- DeleteDC( pd.hDC );
- return FALSE;
- }
- pQu = CurQu;
- for( int i = 0; i < 3; i ++ ) {
- CurQu ++;
- if( bIsGBorBIG5 ) GBQu = CurQu;
- else BIG5Qu = CurQu;
- xMyDraw();
- if( ! StretchBlt(
- pd.hDC,
- xLeft,yTop+( int )( ( float )( rc.bottom * fScaleY ) ) * i,
- ( int )( ( float )( rc.right * fScaleX ) ),( int )( ( float )( rc.bottom * fScaleY ) ),
- hVDC,
- 0,0,
- rc.right,rc.bottom,
- SRCCOPY
- ) ) {
- MessageBox( hWnd,"Printing failure!",szTitle,MB_OK | MB_ICONINFORMATION );
- }
- }
- if( bIsGBorBIG5 )
- wsprintf( tmp,"GB Character Set( Section %d to %d ) [ P.%d of %d ]",pQu + 1,CurQu,CurPages + 1,Pages );
- else
- wsprintf( tmp,"BIG5 Character Set( Section %d to %d ) [ P.%d of %d ]",pQu + 1,CurQu,CurPages + 1,Pages );
- TextOut( pd.hDC,xLeft,cHeightPels - 150,tmp,lstrlen( tmp ) );
- nRet = EndPage( pd.hDC );
- if( nRet <= 0 ) {
- DeleteDC( pd.hDC );
- return FALSE;
- }
- }
- if( bIsGBorBIG5 ) GBQu = oldQu;
- else BIG5Qu = oldQu;
- nRet = EndDoc( pd.hDC );
- if( nRet <= 0 ) {
- DeleteDC( pd.hDC );
- return FALSE;
- }
- DeleteDC( pd.hDC );
- return TRUE;
- }