class LboxDlg : public LboxWin

  オブジェクトの作成と削除



  
LboxDlg *Dlg;

LRESULT CALLBACK About( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
	switch( message ) {
		case WM_INITDIALOG:
			Dlg = new LboxDlg( hDlg );
			return TRUE;

		case WM_COMMAND:
			if( LOWORD(wParam) == IDCANCEL ) {
				Dlg->End( LOWORD(wParam) );
				delete Dlg;
			}
			break;
	}
	return FALSE;
}
  



  コンストラクタ



  
// *********************************************************
// コンストラクタ
// *********************************************************
LboxDlg::LboxDlg( HWND hWnd )
{
	LboxDlg::hDlg = hWnd;
	LboxDlg::hStatus = NULL;
}
  

hWnd には、ダイアログボックスのウインドウハンドルを指定します

  
// *********************************************************
// デストラクタ
// *********************************************************
LboxDlg::~LboxDlg()
{
	if ( LboxDlg::hStatus != NULL ) { 
		DestroyWindow(
			LboxDlg::hStatus
		);
	}
}
  



  End

  
// *********************************************************
// ダイアログを終了する
// 戻り値 : 無し
// *********************************************************
void LboxDlg::End( int nResult )
{
	EndDialog(
		LboxDlg::hDlg,
		nResult
	);
}
  



  ListAdd

  
// *********************************************************
// リストボックスに文字列を追加
// 戻り値 : 追加された位置
// *********************************************************
int LboxDlg::ListAdd(int nID, LboxString *LString )
{
	return LboxDlg::ListAdd( 
		nID,
		LString->szLboxString
	);
}
int LboxDlg::ListAdd(int nID, LPCTSTR pszBuffer)
{
	return LboxListAdd( 
		GetDlgItem( LboxDlg::hDlg, nID ),
		pszBuffer
	);
}
  



  ListInsert

  
// *********************************************************
// リストボックスに文字列を挿入
// 戻り値 : 挿入された位置
// *********************************************************
int LboxDlg::ListInsert(int nID, int nIndex, LboxString *LString )
{
	return LboxDlg::ListInsert(
		nID,
		nIndex,
		LString->szLboxString
	);
}
int LboxDlg::ListInsert(int nID, int nIndex, LPCTSTR pszBuffer)
{
	return LboxListInsert(
		GetDlgItem( LboxDlg::hDlg, nID ),
		nIndex,
		pszBuffer
	);
}
  



  ListDelete

  
// *********************************************************
// リストボックスの指定行を削除
// 戻り値 : リスト内に残っている文字列の総数
// 戻り値 : 存在しない行を指定すると -1
// *********************************************************
int LboxDlg::ListDelete(int nID, int nIndex)
{
	return LboxListDelete(
		GetDlgItem( LboxDlg::hDlg, nID ),
		nIndex
	);
}
  



  ListGetText

  
// *********************************************************
// リストボックスから文字列を取得
// 戻り値 : 取得した文字列の長さ
// *********************************************************
int LboxDlg::ListGetText(int nID, int nIndex, LboxString *LString )
{
	int nLen;

	while( 1 ) {
		nLen = LboxDlg::ListGetText(
			nID,
			nIndex,
			LString->szLboxString,
			LString->nLboxString
		);
		if ( nLen >= (int)(LString->nLboxString) - 2 ) {
			if ( LString->nLboxString > LBOX_STRINGMAX ) {
				break;
			}
			LString->Resize( LString->nLboxString + MAX_PATH );
			continue;
		}
		break;
	}
	return nLen;

}
int LboxDlg::ListGetText(int nID, int nIndex, LPCTSTR pszBuffer, int nSize )
{
	return LboxListGetText(
		GetDlgItem( LboxDlg::hDlg, nID ),
		nIndex,
		pszBuffer,
		nSize
	);
}
  



  ListSetText

  
// *********************************************************
// リストボックスの指定行を更新
// 戻り値 : 挿入された位置
// 戻り値 : 失敗すると -1
// *********************************************************
int LboxDlg::ListSetText(int nID, int nIndex, LboxString *LString)
{
	return LboxDlg::ListSetText(
		nID,
		nIndex,
		LString->szLboxString
	);
}
int LboxDlg::ListSetText(int nID, int nIndex, LPCTSTR pszBuffer)
{
	return LboxListSetText(
		GetDlgItem( LboxDlg::hDlg, nID ),
		nIndex,
		pszBuffer
	);
}
  

  
// *********************************************************
// リストボックスの指定行を更新
// 戻り値 : 挿入された位置
// 戻り値 : 失敗すると -1
// *********************************************************
int LboxListSetText( HWND hWnd, int nIndex, LPCTSTR pszBuffer )
{
	int ret;

	ret = LboxListDelete(
		hWnd,
		nIndex
	);
	if ( ret == -1 ) {
		return ret;
	}
	ret = LboxListInsert(
		hWnd,
		nIndex,
		pszBuffer
	);

	return ret;
}
  



  ListCount

  
// *********************************************************
// リストボックスの行数取得
// 戻り値 : 行数
// *********************************************************
int LboxDlg::ListCount(int nID )
{
	return LboxListCount(
		GetDlgItem( LboxDlg::hDlg, nID )
	);
}
  



  ListSelectedRow

  
// *********************************************************
// リストボックスの選択された行の取得
// 戻り値 : 選択された行(選択されていない場合は -1 )
// *********************************************************
int LboxDlg::ListSelectedRow(int nID )
{
	return LboxListSelectedRow(
		GetDlgItem( LboxDlg::hDlg, nID )
	);
}
  



  ListSelectedGetText

  
// *********************************************************
// 選択した行の文字列を取得
// 戻り値 : 取得した文字列の長さ
// 戻り値 : エラーの場合は -1
// *********************************************************
int LboxDlg::ListSelectedGetText(int nID, LboxString *LString )
{
	int nLen;

	while( 1 ) {
		LboxDlg::ListSelectedGetText(
			nID,
			LString->szLboxString,
			LString->nLboxString
		);
		nLen = lstrlen( LString->szLboxString );
		if ( nLen >= (int)(LString->nLboxString) - 2 ) {
			if ( LString->nLboxString > LBOX_STRINGMAX ) {
				break;
			}
			LString->Resize( LString->nLboxString + MAX_PATH );
			continue;
		}
		break;
	}
	return nLen;

}
int LboxDlg::ListSelectedGetText( int nID, LPCTSTR pszBuffer, int nSize )
{
	return LboxListSelectedGetText(
		GetDlgItem( LboxDlg::hDlg, nID ),
		pszBuffer,
		nSize
	);
}
  



  ListSelectedSetText

  
// *********************************************************
// 選択した行に文字列を設定
// 戻り値 : 挿入された位置
// 戻り値 : エラーの場合は -1
// *********************************************************
int LboxDlg::ListSelectedSetText( int nID, LboxString *LString )
{
	return LboxDlg::ListSelectedSetText(
		nID,
		LString->szLboxString
	);
}
int LboxDlg::ListSelectedSetText( int nID, LPCTSTR pszBuffer )
{
	return LboxListSelectedSetText(
		GetDlgItem( LboxDlg::hDlg, nID ),
		pszBuffer
	);
}
  



  ListSelectedDelete

  
// *********************************************************
// 選択した行を削除
// 戻り値 : リスト内に残っている文字列の総数
// 戻り値 : エラーの場合は -1
// *********************************************************
int LboxDlg::ListSelectedDelete( int nID )
{
	return LboxListSelectedDelete(
		GetDlgItem( LboxDlg::hDlg, nID )
	);
}
  



  ListSelect

  
// *********************************************************
// リストボックスの指定行を選択
// 戻り値 : 無し
// *********************************************************
void LboxDlg::ListSelect(int nID, int nIndex )
{
	LboxListSelect(
		GetDlgItem( LboxDlg::hDlg, nID ),
		nIndex
	);
}
  



  ListReset

  
// *********************************************************
// リストボックスのリセット
// 戻り値 : 無し
// *********************************************************
void LboxDlg::ListReset(int nID )
{
	LboxListReset(
		GetDlgItem( LboxDlg::hDlg, nID )
	);
}
  



  ListDump

  
// *********************************************************
// リストボックスにダンプ結果を表示
// *********************************************************
void LboxDlg::ListDump(int nID, LPCTSTR pszBuffer, int nSize)
{
	LboxListDump(
		GetDlgItem( LboxDlg::hDlg, nID ),
		pszBuffer,
		nSize
	);
}
  

  
// *********************************************************
// リストボックスにダンプ結果を表示
// *********************************************************
void LboxListDump( HWND hWnd, LPCTSTR pszBuffer, int nSize )
{
	int i,j,nRow,nPos;
	char szBuffer[80];

	nRow = nPos = 0;
	for( i = 0; i < nSize; i += 16 ) {
		for( j = i; j < i + 16; j++ ) {
			wsprintf( 
				szBuffer+(j-i)*3,
				"%02x ",
				0x000000ff & *(pszBuffer+nPos)
			);
			nPos++;
		}
		CharUpperBuff( szBuffer, 80 );
		LboxListInsert( hWnd, nRow, szBuffer );
		nRow++;
	}
}
  



  ListPrintf

  
// *********************************************************
// リストボックスにフォーマットした文字列を表示
// *********************************************************
void LboxDlg::ListPrintf(int nID, LPSTR FormatString, ...)
{
	va_list marker;
	char szBuffer[1024];

	char *szNewBuff = new char[lstrlen(FormatString)+10];
	lstrcpy( szNewBuff, FormatString );

	va_start(marker, FormatString);
	vsprintf(szBuffer, szNewBuff, marker);
	va_end(marker);              

	unsigned char *pszToken;
	int nRow = 0;

	pszToken = _mbstok(
		(unsigned char *)szBuffer,
		(const unsigned char *)"\n"
	);
	while( pszToken != NULL ) {
		LboxListInsert(
			GetDlgItem( LboxDlg::hDlg, nID ),
			nRow,
			(LPCTSTR)pszToken
		);
		nRow++;
		pszToken = _mbstok( NULL, (const unsigned char *)"\n" );
	}

	delete [] szNewBuff;
}
  



  ListToken

  
// *********************************************************
// トークンを追加
// 戻り値 : トークンの数
// *********************************************************
int LboxDlg::ListToken(int nID, LPTSTR pszBuffer, LPTSTR pszDelimiter )
{
	return LboxListToken(
		GetDlgItem( LboxDlg::hDlg, nID ),
		pszBuffer,
		pszDelimiter
	);
}
  

pszBuffer には、pszDelimiter で区切られた 0 個以上のトークンを含む文字列へのポインタを渡します



  ListCopyClipboard

  
// *********************************************************
// クリップボードにコピー
// 行の終わりには、改行コードを付加
// bSelect が true の場合は 選択した行のみコピーする
// 戻り値 : true 成功, false 失敗
// *********************************************************
BOOL LboxDlg::ListCopyClipboard( int nID, BOOL bSelect )
{
	return LboxListCopyClipboard(
		GetDlgItem( LboxDlg::hDlg, nID ),
		bSelect
	);
}
  

  
// *********************************************************
// クリップボードにコピー
// 行の終わりには、改行コードを付加
// bSelect が true の場合は 選択した行のみコピーする
// 戻り値 : true 成功, false 失敗
// *********************************************************
BOOL LboxListCopyClipboard( HWND hWnd, BOOL bSelect )
{
	DWORD nSize;
	int nRows,i;
	BOOL bFlg;

	nSize = 0;
	nRows = LboxListCount( hWnd );
	for( i = 0; i < nRows; i++ ) {
		if ( bSelect ) {
			bFlg = (BOOL)SendMessage(
				hWnd,
				LB_GETSEL,
				(WPARAM)i,
				0L
			);
			if ( !bFlg ) {
				continue;
			}
		}
		nSize += (DWORD)SendMessage(
			hWnd,
			LB_GETTEXTLEN,
			(WPARAM)i,
			0L
		);
		nSize++;
	}

	HGLOBAL hGlobal;
	LPTSTR pMem;

	hGlobal = GlobalAlloc(GHND, nSize + 128 );
	if ( hGlobal == NULL ) {
		return false;
	}
	pMem = (LPTSTR)GlobalLock( hGlobal );
	if ( pMem == NULL ) {
		GlobalFree( hGlobal );
		return false;
	}
	
	*pMem = 0x00;

	for( i = 0; i < nRows; i++ ) {
		if ( bSelect ) {
			bFlg = (BOOL)SendMessage(
				hWnd,
				LB_GETSEL,
				(WPARAM)i,
				0L
			);
			if ( !bFlg ) {
				continue;
			}
		}
		SendMessage(
			hWnd,
			LB_GETTEXT,
			(WPARAM)i,
			(LPARAM)(LPCTSTR)pMem
		);
		lstrcat( pMem, "\n" );
		pMem = pMem + lstrlen( pMem );
	}

	GlobalUnlock( hGlobal );
	OpenClipboard( NULL );
	EmptyClipboard();
	SetClipboardData(CF_TEXT, hGlobal);
	CloseClipboard();

	return true;
}
  



  EditGetText

  
// *********************************************************
// エディット コントロールから文字列を取得
// 戻り値 : バッファに格納された文字列の長さ
// 戻り値 : エラーの時は -1
// *********************************************************
int LboxDlg::EditGetText(int nID, LboxString *LString )
{
	int nLen;

	while( 1 ) {
		nLen = (DWORD)GetDlgItemText(
			LboxDlg::hDlg,
			nID,
			LString->szLboxString,
			LString->nLboxString
		);
		if ( nLen == 0 ) {
			return -1;
		}
		if ( nLen >= (int)(LString->nLboxString) - 2 ) {
			if ( LString->nLboxString > LBOX_STRINGMAX ) {
				break;
			}
			LString->Resize( LString->nLboxString + MAX_PATH );
			continue;
		}
		break;
	}
	return (int)nLen;
}
int LboxDlg::EditGetText(int nID, LPSTR pszBuffer, int nSize )
{
	int ret;

	ret = GetDlgItemText(
		LboxDlg::hDlg,
		nID,
		pszBuffer,
		nSize
	);

	if ( ret == 0 ) {
		return -1;
	}

	return ret;
}
  



  EditSetText

  
// *********************************************************
// エディット コントロールに文字列をセット
// 戻り値 : 0 以外
// 戻り値 : エラーの時は 0
// *********************************************************
int LboxDlg::EditSetText(int nID, LboxString *LString )
{
	return LboxDlg::EditSetText( nID, LString->szLboxString );
}
int LboxDlg::EditSetText(int nID, LPCTSTR pszBuffer )
{
	int ret;

	ret = SetDlgItemText(
		LboxDlg::hDlg,
		nID,
		pszBuffer
	);

	return ret;
}
  



  EditSetInt

  
// *********************************************************
// エディット コントロールに整数値をセット
// 戻り値 : 0 以外
// 戻り値 : エラーの時は 0
// *********************************************************
int LboxDlg::EditSetInt(int nID, int nValue )
{
	int ret;

	ret = SetDlgItemInt(
		LboxDlg::hDlg,
		nID,
		(UINT)nValue,
		true
	);

	return ret;
}
  



  EditLimitText

  
// *********************************************************
// エディットコントロールのテキストの文字数を制限
// 戻り値 : 無し
// *********************************************************
void LboxDlg::EditLimitText(int nID, int nSize )
{
	LboxEditLimitText(
		GetDlgItem( LboxDlg::hDlg, nID ),
		nSize
	);

}
  



  EditFocus, EditSelect

  
// *********************************************************
// フォーカスの設定
// 戻り値 : 以前にフォーカスを持っていたウィンドウのハンドル
// *********************************************************
HWND LboxDlg::EditFocus(int nID )
{
	HWND hWnd;

	hWnd = LboxEditFocus(
		GetDlgItem( LboxDlg::hDlg, nID )
	);

	return hWnd;
}
  

  
// *********************************************************
// エディットコントロール内のテキストを選択状態にする
// (フォーカスが設定済みの場合のみ)
// 戻り値 : 無し
// *********************************************************
void LboxDlg::EditSelect(int nID )
{
	LboxEditSelect(
		GetDlgItem( LboxDlg::hDlg, nID )
	);
}
  



  EditReadonly

  
// *********************************************************
// 読み取り専用モードの設定と解除
// 戻り値 : 0 以外
// 戻り値 : エラーは 0
// *********************************************************
int LboxDlg::EditReadonly(int nID, BOOL bFlg )
{
	int ret;

	ret = LboxEditReadonly(
		GetDlgItem( LboxDlg::hDlg, nID ),
		bFlg
	);

	return ret;
}
  



  Enable, Disable

  
// *********************************************************
// コントロールを使用可能にする
// 戻り値 : 無し
// *********************************************************
void LboxDlg::Enable(int nID )
{
	EnableWindow( 
		GetDlgItem( LboxDlg::hDlg, nID ),
		true
	);
}
  

  
// *********************************************************
// コントロールを使用不可能にする
// 戻り値 : 無し
// *********************************************************
void LboxDlg::Disable(int nID )
{
	EnableWindow( 
		GetDlgItem( LboxDlg::hDlg, nID ),
		false
	);
}
  



  Show, Hide

  
// *********************************************************
// コントロールを表示状態にする
// 戻り値 : 無し
// *********************************************************
void LboxDlg::Show(int nID )
{
	ShowWindow(
		GetDlgItem( LboxDlg::hDlg, nID ),
		SW_SHOW
	);
}
  

  
// *********************************************************
// コントロールを非表示状態にする
// 戻り値 : 無し
// *********************************************************
void LboxDlg::Hide(int nID )
{
	ShowWindow(
		GetDlgItem( LboxDlg::hDlg, nID ),
		SW_HIDE
	);
}
  



  StatusCreate

  
// *********************************************************
// ステータスバーの実装
// 戻り値 : 無し
// *********************************************************
void LboxDlg::StatusCreate( int nID )
{
	if ( LboxDlg::hStatus != NULL ) { 
		DestroyWindow(
			LboxDlg::hStatus
		);
	}

	LboxDlg::hStatus =
		CreateWindowEx( 
			0,
			STATUSCLASSNAME,
			(LPCTSTR)NULL,
			WS_CHILD | WS_VISIBLE,
			0, 0, 0, 0,
			LboxDlg::hDlg,
			(HMENU)(nID),
			LboxGetInstance(GetParent(LboxDlg::hDlg)),
			NULL
		);
		SendMessage(
			LboxDlg::hStatus,
			SB_SIMPLE,
			(WPARAM)true,
			0L
		);
}
  



  StatusSetText

  
// *********************************************************
// ステータスバーに文字列を表示
// 戻り値 : 無し
// *********************************************************
void LboxDlg::StatusSetText( LPTSTR szText )
{
	if ( LboxDlg::hStatus != NULL ) { 
		SendMessage(
			LboxDlg::hStatus,
			SB_SETTEXT,
			(WPARAM)255,
			(LPARAM)szText
		);
	}
}
  



  StatusGetText

  
// *********************************************************
// ステータスバーより文字列を取得
// 戻り値 : 無し
// *********************************************************
void LboxDlg::StatusGetText( LPTSTR szText )
{
	if ( LboxDlg::hStatus != NULL ) { 
		SendMessage(
			LboxDlg::hStatus,
			SB_GETTEXT,
			(WPARAM)0,
			(LPARAM)szText
		);
	}
}
  



  StatusPrintf

  
// *********************************************************
// ステータスバーにフォーマットした文字列を表示
// 戻り値 : 無し
// *********************************************************
void LboxDlg::StatusPrintf( LPSTR FormatString, ...)
{
	if ( LboxDlg::hStatus == NULL ) {
		return;
	}

	va_list marker;
	char *szBuffer = new char[1024];

	va_start(marker, FormatString);
	wvsprintf(szBuffer, FormatString, marker);
	va_end(marker);              

	SendMessage(
		LboxDlg::hStatus,
		SB_SETTEXT,
		(WPARAM)255,
		(LPARAM)szBuffer
	);

	delete [] szBuffer;
}
  



  Enable, Disable

  
// *********************************************************
// ダイアログを使用可能にする
// 戻り値 : 無し
// *********************************************************
void LboxDlg::Enable( void )
{
	EnableWindow( 
		LboxDlg::hDlg,
		true
	);
}
  

  
// *********************************************************
// ダイアログを使用不可能にする
// 戻り値 : 無し
// *********************************************************
void LboxDlg::Disable( void )
{
	EnableWindow( 
		LboxDlg::hDlg,
		false
	);
}
  



  Show, Hide

  
// *********************************************************
// ダイアログを表示状態にする
// 戻り値 : 無し
// *********************************************************
void LboxDlg::Show( void )
{
	ShowWindow(
		LboxDlg::hDlg,
		SW_SHOW
	);
}
  

  
// *********************************************************
// ダイアログを非表示状態にする
// 戻り値 : 無し
// *********************************************************
void LboxDlg::Hide( void )
{
	ShowWindow(
		LboxDlg::hDlg,
		SW_HIDE
	);
}
  



  CenterWindow

  
// *********************************************************
// ダイアログをデスクトップ中央に移動
// 戻り値 : 無し
// *********************************************************
void LboxDlg::CenterWindow( void )
{
	LboxCenterWindow( LboxDlg::hDlg );
}
  

LboxCenterWindow



  GetTitle, SetTitle

  
// *********************************************************
// タイトル文字列の取得
// 戻り値 : 無し
// *********************************************************
void LboxDlg::GetTitle( LPTSTR lpString, int nSize )
{
	GetWindowText( LboxDlg::hDlg, lpString, nSize );
}

// *********************************************************
// タイトル文字列の設定
// 戻り値 : 無し
// *********************************************************
void LboxDlg::SetTitle( LPTSTR lpString )
{
	SetWindowText( LboxDlg::hDlg, lpString );
}
  



  ListTextSize

  
// *********************************************************
// リストボックス全体のテキストサイズを NULL を含めて計算する
// 戻り値 : テキストサイズ
// *********************************************************
int LboxDlg::ListTextSize( int nID )
{
	return LboxListTextSize( GetDlgItem( LboxDlg::hDlg, nID ) );
}
  



  ListCreateToken

  
// *********************************************************
// リストボックスからトークンを作成
// 戻り値 : 無し
// *********************************************************
void LboxDlg::ListCreateToken( int nID, LboxToken *obj )
{
	LboxListCreateToken( GetDlgItem( LboxDlg::hDlg, nID ), obj );
}
  



  StatusFit

  
// *********************************************************
// ステータスバーを親ウインドウにフィットさせる
// 戻り値 : 無し
// *********************************************************
void LboxDlg::StatusFit( WPARAM wParam, LPARAM lParam )
{
	if ( LboxDlg::hStatus != NULL ) {
		SendMessage( LboxDlg::hStatus, WM_SIZE, wParam, lParam );
	}
}
  



  アイコンハンドルの書き換え

  
// *********************************************************
// アイコンハンドルの書き換え
// 戻り値 : 無し
// *********************************************************
void LboxDlg::ChangeIcon( int nID )
{
	SetClassLong(
		LboxDlg::hDlg,
		GCL_HICON,
		(LONG)(LoadIcon(
			LboxGetInstance( LboxDlg::hDlg ),
			MAKEINTRESOURCE( nID )
		))
	);
}
  



  EditNumberonly

  
// *********************************************************
// 数字のみの入力の設定と解除
// 戻り値 : 無し
// *********************************************************
void LboxDlg::EditNumberonly( int nID, BOOL bFlg )
{
	LboxEditNumberonly( 
		GetDlgItem( LboxDlg::hDlg, nID ),
		bFlg
	);
}
  



  EditAlign

  
// *********************************************************
// 左寄せ・右寄せ・中央のフォーマットを適用
// nType
// 0 : 左寄せ, 1 : 右寄せ, 2 : 中央
// 戻り値 : 無し
// *********************************************************
void LboxDlg::EditAlign( int nID, int nType )
{
	LboxEditAlign( 
		GetDlgItem( LboxDlg::hDlg, nID ),
		nType
	);
}
  



  EditPassword

  
// *********************************************************
// パスワードフィールドを作成
// lpPassChar
// パスワード文字列( 1文字 )
// "" だとパスワード解除
// 戻り値 : 無し
// *********************************************************
void LboxDlg::EditPassword( int nID, LPTSTR lpPassChar )
{
	LboxEditPassword(
		GetDlgItem( LboxDlg::hDlg, nID ),
		lpPassChar
	);
}
  



  EditCase

  
// *********************************************************
// アルファベットに対する特殊フィールドを作成
// nType
// 0 : ノーマル, 1 : 全て小文字に変換, 2 : 全て大文字に変換
// 戻り値 : 無し
// *********************************************************
void LboxDlg::EditCase( int nID, int nType )
{
	LboxEditCase( GetDlgItem( LboxDlg::hDlg, nID ), nType );
}
  



  ButtonIsCheck

  
// *********************************************************
// ボタンがチェックされているかどうか
// 戻り値 : true チェック有, false チェック無し
// *********************************************************
BOOL LboxDlg::ButtonIsCheck( int nID )
{
	return LboxButtonIsCheck( GetDlgItem( LboxDlg::hDlg, nID ) );
}
  



  ButtonCheck

  
// *********************************************************
// ボタンのチェックを ON/OFF する
// 戻り値 : 無し
// *********************************************************
void LboxDlg::ButtonCheck( int nID, BOOL bFlg )
{
	LboxButtonCheck( GetDlgItem( LboxDlg::hDlg, nID ), bFlg );
}
  



  EditPrintf

  
// *********************************************************
// エディットコントロールにフォーマットした文字列を表示
// 戻り値 : 無し
// *********************************************************
void LboxDlg::EditPrintf( int nID, LPSTR FormatString, ...)
{
	va_list marker;
	char *szBuffer = new char[1024];

	va_start(marker, FormatString);
	wvsprintf(szBuffer, FormatString, marker);
	va_end(marker);              

	LboxDlg::EditSetText(
		nID,
		szBuffer
	);

	delete [] szBuffer;
}
  



  ListFindString

  
// *********************************************************
// リストボックス内の文字列の検索
// 戻り値 : 一致する行のインデックス(失敗時は-1)
// *********************************************************
int LboxDlg::ListFindString( int nID, LboxString *LString )
{
	return LboxDlg::ListFindString( nID, LString->szLboxString );
}
int LboxDlg::ListFindString( int nID, LPTSTR lpFind )
{
	return LboxListFindString(
		GetDlgItem( LboxDlg::hDlg, nID ),
		lpFind
	);
}
  



  GetHandle

  
// *********************************************************
// ウインドウハンドルを取得する
// 戻り値 : 無し
// *********************************************************
HWND LboxDlg::GetHandle( int nID )
{
	return GetDlgItem(
		LboxDlg::hWnd,
		nID
	);
}
  



  IsControlEnabled

  
// *********************************************************
// 有効状態かどうか
// 戻り値 : true 表示, false 非表示
// *********************************************************
BOOL LboxDlg::IsControlEnabled( int nID )
{
	return IsWindowEnabled(
		GetDlgItem( LboxDlg::hDlg, nID )
	);
}
  



  IsControlVisible

  
// *********************************************************
// 表示状態かどうか
// 戻り値 : true 表示, false 非表示
// *********************************************************
BOOL LboxDlg::IsControlVisible( int nID )
{
	return IsWindowVisible( 
		GetDlgItem( LboxDlg::hDlg, nID )
	);
}
  



  EditIsReadonly

  
// *********************************************************
// Readonly かどうか調べる
// 戻り値 : 無し
// *********************************************************
BOOL LboxDlg::EditIsReadonly( int nID )
{
	DWORD dwData;

	dwData = GetWindowLong(
		GetDlgItem( LboxDlg::hDlg, nID ), GWL_STYLE	);
	if ( dwData & ES_READONLY ) {
		return true;
	}
	return false;
}
  



  EditChangeFzero

  
// *********************************************************
// エディット コントロールの内容を先行ゼロ文字列に変更
// 戻り値 : 0 以外
// 戻り値 : エラーの時は 0
// *********************************************************
void LboxDlg::EditChangeFzero(int nID, int nLen )
{
	LboxString *LString1;
	LboxString *LString2;
	LString1 = new LboxString();
	LString2 = new LboxString();

	LboxDlg::EditGetText( nID, LString1 );
	LString2->Fzero( LString1, nLen );
	LboxDlg::EditSetText( nID, LString2 );

	delete LString1;
	delete LString2;
}
  










  infoboard   管理者用   
このエントリーをはてなブックマークに追加





フリーフォントWEBサービス
SQLの窓WEBサービス

SQLの窓フリーソフト

素材

一般WEBツールリンク

SQLの窓

フリーソフト

JSライブラリ