www.pudn.com > cb_dic1.rar > main.c


/*-------------------------------------------------*
* $RCSfile$
* $Date$
* $Author$
* $Log$
* Function	:
* Usage         :
* Version	:
* Return Code   :
* Revision      :
* Remark        :
*--------------------------------------------------*/

#pragma far_pid_on
#pragma far_pic_on


#include "cb_dic/cb_dic.h"

LRESULT CALLBACK wproc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
	HDC hdc;
	PAINTSTRUCT ps;
	
	switch ( msg ) {
		case WM_CREATE:
			break;
		case WM_SWITCH_IN:
			break;
		case WM_PAINT:
			hdc = BeginPaint( hwnd, &ps );
			EndPaint( hwnd, &ps );
			break;
		case WM_DESTROY:
			PostQuitMessage( 0 );
			break;
		default:
			return DefWindowProc( hwnd, msg, wParam, lParam );
	}
	return FALSE;
}
#if LINUX_FS
INT16 MwUserInit( int argc, char **argv )
{
	printf( "[%s]:Date:$Date$ Ver=$Revision$\n", argv[0] );
	printf( "%s\n", cb_dica_get_version( ) );

	return TRUE;
}

void MwUserClose( void )
{
	return;
}
#endif

int RegisterAppClass( char *szAppName )
{
	WNDCLASS wndclass;

        wndclass.style          = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
        wndclass.lpfnWndProc    = (WNDPROC)wproc;
        wndclass.cbClsExtra     = FALSE;
        wndclass.cbWndExtra     = FALSE;
        wndclass.hInstance      = FALSE;
        wndclass.hIcon          = FALSE;
        wndclass.hCursor        = FALSE;
        wndclass.hbrBackground  = ( HBRUSH )GetStockObject( WHITE_BRUSH );
        wndclass.lpszMenuName   = NULL;
        wndclass.lpszClassName  = szAppName;

        RegisterClass( &wndclass );

	return TRUE;
}


#if LINUX_FS

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow )

#else

int WINAPI CBWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow )

#endif


{
        HWND	hwnd;
        MSG	msg;
#if	0
	HWND	hxime;
#endif
        static char s_szAppName[] = APNAME;
	
	//First get the useful msg

		
	if( cba_init( ) == CB_RTN_ERROR ) {
		MessageBox( NULL, STR_FWRITE_ERR, STR_WRONG, MB_OK |MB_ICONSTOP );
		exit( -1 );
	}

	
	RegisterAppClass( s_szAppName );
    hwnd = CreateWindowEx( 0L, s_szAppName, "--CBDIC--",
			       WS_VISIBLE, FALSE, FALSE,
			       V6100_WIDTH, V6100_HEIGHT,
			       NULL, NULL, NULL, NULL );

	DialogBoxEx( NULL, "DLG_MAIN", hwnd, dlgMainProc, dialog_info, MAIN );
	ShowWindow( hwnd, iCmdShow );
    UpdateWindow( hwnd );
	
	while( GetMessage( &msg, NULL, FALSE, FALSE ) ) {
		TranslateMessage( &msg );
		DispatchMessage( &msg );
	}
	return msg.wParam;
}

#pragma far_pic_off
#pragma far_pid_off