/*
 * TEST : テストアプリケーション：メインルーチン
 * Copyright(C) 1997-1999 Eiichiro Ito
 *
 * 1998/02/20:Eiichiro Ito
 *  (1) 作成開始
 * 修正履歴
 * 1998/03/31:Eiichiro Ito
 *  (1) テスト表示内容修正
 *
 */
#include	"conslib.h"
#include	<tchar.h>

TCHAR	AppName[] = TEXT("TEST") ;	/* 必須項目 */

TCHAR	MessageBuf[ 256 ] ;

BOOL	(*pProcAddress)( void ) = 0 ;

int
Main( DWORD argc, LPTSTR argv[] )
{
	double  dblValue = 1.55 ;
    int     nCount = 16;
    int     nDec = 0;
    int     nSign = 0;
	LPSTR   lpszDouble ;
	wsprintf( MessageBuf, TEXT("%2.3f"), &dblValue ) ;
	Cputs( MessageBuf ) ;

    lpszDouble = _fcvt(dblValue, nCount, &nDec, &nSign);

	mbstowcs( MessageBuf, lpszDouble, sizeof MessageBuf / sizeof *MessageBuf ) ;
	_tcscat( MessageBuf, TEXT("\n") ) ;
	Cputs( MessageBuf ) ;

#if 0
	HINSTANCE		hLib ;

	if ( argc <= 2 ) {
		wsprintf( MessageBuf, TEXT("%s DllName ProcName\n"), AppName ) ;
		Cputs( MessageBuf ) ;
		return 0 ;
	}
	hLib = LoadLibrary( argv[ 1 ] ) ;
	if ( hLib == NULL ) {
		wsprintf( MessageBuf, TEXT("LoadLibrary:%d\n"), GetLastError() ) ;
		Cputs( MessageBuf ) ;
		return 0 ;
	}
	pProcAddress = (BOOL(*)( void )) GetProcAddress( hLib, argv[ 2 ] ) ;
	if ( pProcAddress ) {
		wsprintf( MessageBuf, TEXT("%s = %8x\n"), argv[ 2 ], pProcAddress ) ;
	} else {
		wsprintf( MessageBuf, TEXT("Can't find %s in %s\n"), argv[ 2 ], argv[ 1 ] ) ;
	}
	Cputs( MessageBuf ) ;
	FreeLibrary( hLib ) ;
#endif
	return 0 ;
}
