LboxBasp


  コンストラクタ




Basp21 をインストールする必要があります

このクラスを使用する場合は、アプリケーションの開始処理に CoInitialize( NULL ) を実行し、
アプリケーションの終了処理に CoUninitialize( ) を実行して下さい

  

// *********************************************************
// デフォルトコンストラクタ
// *********************************************************
LboxBasp::LboxBasp()
{
	this->lib = LoadLibrary( "Bsmtp.dll" );

	User.SetChar( 0, 0 );
	Password.SetChar( 0, 0 );

	LboxTool Tool;
	LboxFileSystem Fs;

	RcvDir.Resize( MAX_PATH );
	Tool.ProgramDirectory( this->RcvDir.szLboxString );
	this->RcvDir.AddBackslash();
	this->RcvDir.operator += ( "RcvDir" );
	if ( !(Fs.IsDirectory( this->RcvDir.szLboxString ) ) ) {
		Fs.CreateDirectory( this->RcvDir.szLboxString );
	}

}

// *********************************************************
// デストラクタ
// *********************************************************
LboxBasp::~LboxBasp()
{
	if ( this->lib != NULL ) {
		FreeLibrary( this->lib );
	}
}
  

  SendMail




  

// *********************************************************
// メール送信
// 戻り値 : true 成功, false 失敗
// *********************************************************
BOOL LboxBasp::SendMail(
	LboxString *LTo, LboxString *LFrom, LboxString *LSubj, LboxString *LBody )
{
	return LboxBasp::SendMail(
		LTo->szLboxString,
		LFrom->szLboxString,
		LSubj->szLboxString,
		LBody->szLboxString
	);
}
BOOL LboxBasp::SendMail(
	LPTSTR lpTo, LPTSTR lpFrom, LPTSTR lpSubject, LPTSTR lpBody )
{
	this->ErrorDescription.SetChar(0,0);

	if ( this->lib == NULL ) {
		this->ErrorDescription.operator = (
			"Bsmtp.dll がインストールされていません"
		);
		return false;
	}

	LPFUNC_BSendMail DllBSendMail;

	DllBSendMail =
		(LPFUNC_BSendMail)GetProcAddress( lib, "BSendMail" );
	if ( DllBSendMail == NULL ) {
		return false;
	}

	int nRet;

	this->ErrorDescription.SetChar( 0, 0 );
	nRet = DllBSendMail(
		this->SMTPServer.szLboxString,
		lpTo,
		lpFrom,
		lpSubject,
		lpBody,
		"",
		this->ErrorDescription.szLboxString
	);

	if ( !nRet ) {
		return false;
	}

	return true;

}
  

  RcvList

  

// *********************************************************
// メールヘッダ情報受信
// 戻り値 : true 成功, false 失敗
// *********************************************************
BOOL LboxBasp::RcvList( LboxListview *Lview )
{
	if ( this->User.operator == ( "" ) ) {
		return false;
	}
	return LboxBasp::RcvList(
		this->User.szLboxString,
		this->Password.szLboxString,
		Lview
	);
}
BOOL LboxBasp::RcvList(
	LboxString *LUser, LboxString *LPass, LboxListview *Lview )
{
	return LboxBasp::RcvList(
		LUser->szLboxString,
		LPass->szLboxString,
		Lview
	);
}
BOOL LboxBasp::RcvList(
	LPTSTR lpUser, LPTSTR lpPass, LboxListview *Lview )
{
	this->ErrorDescription.SetChar(0,0);

	if ( this->lib == NULL ) {
		this->ErrorDescription.operator = (
			"Bsmtp.dll がインストールされていません"
		);
		return false;
	}

	LPFUNC_BPOP3 DllBPOP3;
	LPFUNC_BFreeArray DllBFreeArray;

	DllBPOP3 =
		(LPFUNC_BPOP3)GetProcAddress( lib, "BPOP3" );
	if ( DllBPOP3 == NULL ) {
		return false;
	}
	DllBFreeArray =
		(LPFUNC_BFreeArray)GetProcAddress( lib, "BFreeArray" );
	if ( DllBFreeArray == NULL ) {
		return false;
	}


	int nRet;
	RetArray ra;

	this->ErrorDescription.SetChar( 0, 0 );
	nRet = DllBPOP3(
		this->POP3Server.szLboxString,
		lpUser,
		lpPass,
		"LIST",
		this->RcvDir.szLboxString,
		&ra,
		this->ErrorDescription.szLboxString
	);

	if ( nRet <= 0 ) {
		return false;
	}

	Lview->Initialize();
	Lview->AddColumn( LVCFMT_LEFT, 100, "" );
	Lview->AddColumn( LVCFMT_LEFT, 100, "送信者" );
	Lview->AddColumn( LVCFMT_LEFT, 100, "件名" );
	Lview->AddColumn( LVCFMT_LEFT, 100, "受信日時" );

	int i;
	LboxToken Ltoken;
	LboxString LString;

	for( i = 0; i < ra.counter; i++ ) {
		Lview->AddRow();

		Lview->SetColumnPrintf( 0, "%d", i+1 );
		Ltoken.CreateToken( ra.array[i], "\t" );

		LString.operator = (Ltoken.Token[1]);
		LString.Replace( "From: ", "" );
		Lview->SetColumnText( 1, &LString );

		LString.operator = (Ltoken.Token[0]);
		LString.Replace( "Subject: ", "" );
		Lview->SetColumnText( 2, &LString );

		LString.operator = (Ltoken.Token[2]);
		LString.Replace( "Date: ", "" );
		Lview->SetColumnText( 3, &LString );
	}

	DllBFreeArray(&ra);

	Lview->Fit();
	return true;

}
  

  RcvData

  

// *********************************************************
// メールデータ受信
// 戻り値 : true 成功, false 失敗
// *********************************************************
BOOL LboxBasp::RcvData( LboxListview *Lview )
{
	if ( this->User.operator == ( "" ) ) {
		return false;
	}
	return LboxBasp::RcvData(
		this->User.szLboxString,
		this->Password.szLboxString,
		Lview
	);
}
BOOL LboxBasp::RcvData(
	LboxString *LUser, LboxString *LPass, LboxListview *Lview )
{
	return LboxBasp::RcvData(
		LUser->szLboxString,
		LPass->szLboxString,
		Lview
	);
}
BOOL LboxBasp::RcvData(
	LPTSTR lpUser, LPTSTR lpPass, LboxListview *Lview )
{
	this->ErrorDescription.SetChar(0,0);

	if ( this->lib == NULL ) {
		this->ErrorDescription.operator = (
			"Bsmtp.dll がインストールされていません"
		);
		return false;
	}

	LPFUNC_BPOP3 DllBPOP3;
	LPFUNC_BMIME DllBMIME;
	LPFUNC_BFreeArray DllBFreeArray;

	DllBPOP3 =
		(LPFUNC_BPOP3)GetProcAddress( lib, "BPOP3" );
	if ( DllBPOP3 == NULL ) {
		return false;
	}
	DllBMIME =
		(LPFUNC_BMIME)GetProcAddress( lib, "BMIME" );
	if ( DllBMIME == NULL ) {
		return false;
	}
	DllBFreeArray =
		(LPFUNC_BFreeArray)GetProcAddress( lib, "BFreeArray" );
	if ( DllBFreeArray == NULL ) {
		return false;
	}


	int nRet;
	RetArray ra,raRow;
	LboxString LString;

	LString.operator = (">");
	LString.operator += (this->RcvDir.szLboxString);

	this->ErrorDescription.SetChar( 0, 0 );
	nRet = DllBPOP3(
		this->POP3Server.szLboxString,
		lpUser,
		lpPass,
		"SAVEALL",
		LString.szLboxString,
		&ra,
		this->ErrorDescription.szLboxString
	);

	if ( nRet <= 0 ) {
		return false;
	}

	Lview->Initialize();
	Lview->AddColumn( LVCFMT_LEFT, 100, "" );
	Lview->AddColumn( LVCFMT_LEFT, 100, "送信者" );
	Lview->AddColumn( LVCFMT_LEFT, 100, "件名" );
	Lview->AddColumn( LVCFMT_LEFT, 100, "受信日時" );
	Lview->AddColumn( LVCFMT_LEFT, 100, "ファイル" );

	int i,j;

	for( i = 0; i < ra.counter; i++ ) {
		nRet = DllBMIME(
			"GETNOF",
			ra.array[i],
			this->RcvDir.szLboxString,
			&raRow,
			this->ErrorDescription.szLboxString
		);
		if ( nRet <= 0 ) {
			continue;
		}
		Lview->AddRow();

		Lview->SetColumnPrintf( 0, "%d", i+1 );
		Lview->SetColumnText( 4, ra.array[i] );

		for( j = 0; j < raRow.counter; j++ ) {
			LString.operator = (raRow.array[j]);
			LString.SetChar( 5, 0 );
			if ( LString.operator == ("From:") ) {
				LString.operator = (raRow.array[j]);
				LString.Replace( "From: ", "" );
				Lview->SetColumnText( 1, &LString );
			}
		}

		for( j = 0; j < raRow.counter; j++ ) {
			LString.operator = (raRow.array[j]);
			LString.SetChar( 8, 0 );
			if ( LString.operator == ("Subject:") ) {
				LString.operator = (raRow.array[j]);
				LString.Replace( "Subject: ", "" );
				Lview->SetColumnText( 2, &LString );
			}
		}

		for( j = 0; j < raRow.counter; j++ ) {
			LString.operator = (raRow.array[j]);
			LString.SetChar( 5, 0 );
			if ( LString.operator == ("Date:") ) {
				LString.operator = (raRow.array[j]);
				LString.Replace( "Date: ", "" );
				Lview->SetColumnText( 3, &LString );
			}
		}
	}

	DllBFreeArray(&raRow);
	DllBFreeArray(&ra);

	Lview->Fit();
	return true;

}
  

  GetBody

  

// *********************************************************
// 本文読出し
// 戻り値 : true 成功, false 失敗
// *********************************************************
BOOL LboxBasp::GetBody(	
	LboxString *LFile, LboxString *LBody )
{
	return LboxBasp::GetBody(
		LFile->szLboxString,
		LBody
	);
}
BOOL LboxBasp::GetBody(	
	LPTSTR lpFile, LboxString *LBody )
{
	this->ErrorDescription.SetChar(0,0);

	if ( this->lib == NULL ) {
		this->ErrorDescription.operator = (
			"Bsmtp.dll がインストールされていません"
		);
		return false;
	}

	LPFUNC_BMIME DllBMIME;
	LPFUNC_BFreeArray DllBFreeArray;

	DllBMIME =
		(LPFUNC_BMIME)GetProcAddress( lib, "BMIME" );
	if ( DllBMIME == NULL ) {
		return false;
	}
	DllBFreeArray =
		(LPFUNC_BFreeArray)GetProcAddress( lib, "BFreeArray" );
	if ( DllBFreeArray == NULL ) {
		return false;
	}


	int nRet;
	RetArray ra;

	this->ErrorDescription.SetChar( 0, 0 );
	nRet = DllBMIME(
		"GETNOF",
		lpFile,
		this->RcvDir.szLboxString,
		&ra,
		this->ErrorDescription.szLboxString
	);
	if ( nRet <= 0 ) {
		return false;
	}

	int i;
	LboxString LString;

	LBody->SetChar( 0, 0 );
	for( i = 0; i < ra.counter; i++ ) {
		LString.operator = (ra.array[i]);
		LString.SetChar( 5, 0 );
		if ( LString.operator == ("Body:") ) {
			LString.operator = (ra.array[i]);
			LString.Replace( "Body: ", "" );
			if ( LBody->nLboxString
				< LString.nLboxString ) {
				LBody->Resize( LString.nLboxString );
			}
			LBody->operator = (&LString);
			break;
		}
	}

	DllBFreeArray(&ra);

	return true;

}
  

  DelMail

  

// *********************************************************
// メールデータ削除
// 戻り値 : true 成功, false 失敗
// *********************************************************
BOOL LboxBasp::DelMail( LboxString *LFile )
{
	if ( this->User.operator == ( "" ) ) {
		return false;
	}
	return LboxBasp::DelMail(
		this->User.szLboxString,
		this->Password.szLboxString,
		LFile->szLboxString
	);
}
BOOL LboxBasp::DelMail(
	LboxString *LUser, LboxString *LPass, LboxString *LFile )
{
	return LboxBasp::DelMail(
		LUser->szLboxString,
		LPass->szLboxString,
		LFile->szLboxString
	);
}
BOOL LboxBasp::DelMail(
	LPTSTR lpUser, LPTSTR lpPass, LPTSTR lpFile )
{
	this->ErrorDescription.SetChar(0,0);

	if ( this->lib == NULL ) {
		this->ErrorDescription.operator = (
			"Bsmtp.dll がインストールされていません"
		);
		return false;
	}

	LPFUNC_BPOP3 DllBPOP3;
	LPFUNC_BFreeArray DllBFreeArray;

	DllBPOP3 =
		(LPFUNC_BPOP3)GetProcAddress( lib, "BPOP3" );
	if ( DllBPOP3 == NULL ) {
		return false;
	}
	DllBFreeArray =
		(LPFUNC_BFreeArray)GetProcAddress( lib, "BFreeArray" );
	if ( DllBFreeArray == NULL ) {
		return false;
	}


	int nRet;
	RetArray ra;
	LboxString LString;

	LString.operator = (lpFile);
	LString.StripPath();
	LString.Insert( "DELU " );
	
	this->ErrorDescription.SetChar( 0, 0 );
	nRet = DllBPOP3(
		this->POP3Server.szLboxString,
		lpUser,
		lpPass,
		LString.szLboxString,
		this->RcvDir.szLboxString,
		&ra,
		this->ErrorDescription.szLboxString
	);

	DllBFreeArray(&ra);

	return true;

}
  

  ZenToHan

  

// *********************************************************
// 全角を半角に変換
// 戻り値 : true 成功, false 失敗
// *********************************************************
BOOL LboxBasp::ZenToHan( LboxString *LZen, LboxString *LHan )
{
	return ZenToHan(
		LZen->szLboxString,
		LHan
	);
}
BOOL LboxBasp::ZenToHan( LPTSTR lpZen, LboxString *LHan )
{
	return LboxBasp::StrConv(
		8,
		lpZen,
		LHan
	);
}
  

  HanToZen

  

// *********************************************************
// 半角を全角に変換
// 戻り値 : true 成功, false 失敗
// *********************************************************
BOOL LboxBasp::HanToZen( LboxString *LHan, LboxString *LZen )
{
	return HanToZen(
		LHan->szLboxString,
		LZen
	);
}
BOOL LboxBasp::HanToZen( LPTSTR lpHan, LboxString *LZen )
{
	return LboxBasp::StrConv(
		4,
		lpHan,
		LZen
	);
}
  

  StrConv

  

// *********************************************************
// 文字列変換
// 戻り値 : true 成功, false 失敗
// *********************************************************
BOOL LboxBasp::StrConv(
	long nType, LboxString *LBase, LboxString *LOut )
{
	return LboxBasp::StrConv(
		nType,
		LBase->szLboxString,
		LOut
	);
}
BOOL LboxBasp::StrConv(
	long nType, LPTSTR lpBase, LboxString *LOut )
{

	BOOL bRet;
	IBasp21Ptr pBasp;
	_bstr_t Base(lpBase);
	_bstr_t Ret("");

	bRet = true;
	int nErr = 0;

	pBasp	= NULL;
	try {
		TESTHR(pBasp.CreateInstance(__uuidof(Basp21)));
		nErr++;

		Ret.operator = (pBasp->StrConv( Base, nType ));
		nErr++;

		LOut->operator = ((LPTSTR)Ret);

		pBasp.Release();
		pBasp = NULL;
	}
	catch (_com_error &e)
	{
		if ( nErr >= 1 ) {
			pBasp.Release();
			pBasp = NULL;
		}
		bRet = false;
	}

	return bRet;
}
  

  HankanaToZen

  

// *********************************************************
// 文字列の中の半角カナを全角カナに変換
// 戻り値 : true 成功, false 失敗
// *********************************************************
BOOL LboxBasp::HankanaToZen( LboxString *LHan, LboxString *LZen )
{
	return HankanaToZen(
		LHan->szLboxString,
		LZen
	);
}
BOOL LboxBasp::HankanaToZen( LPTSTR lpHan, LboxString *LZen )
{

	BOOL bRet;
	IBasp21Ptr pBasp;
	_bstr_t Han(lpHan);
	_bstr_t Ret("");

	bRet = true;
	int nErr = 0;

	pBasp	= NULL;
	try {
		TESTHR(pBasp.CreateInstance(__uuidof(Basp21)));
		nErr++;

		Ret.operator = (pBasp->HAN2ZEN( Han ));
		nErr++;

		LZen->operator = ((LPTSTR)Ret);

		pBasp.Release();
		pBasp = NULL;
	}
	catch (_com_error &e)
	{
		if ( nErr >= 1 ) {
			pBasp.Release();
			pBasp = NULL;
		}
		bRet = false;
	}

	return bRet;
}
  




yahoo  google  MSDN  MSDN(us)  WinFAQ  Win Howto  tohoho  ie_DHTML  vector  wdic  辞書  天気 


[cmstd]
Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
24/04/20 08:31:51
InfoBoard Version 1.00 : Language=Perl

1 BatchHelper COMprog CommonSpec Cprog CprogBase CprogSAMPLE CprogSTD CprogSTD2 CprogWinsock Cygwin GameScript HTML HTMLcss InstallShield InstallShieldFunc JScript JScriptSAMPLE Jsfuncs LLINK OldProg OracleGold OracleSilver PRO PRObrowser PROc PROconePOINT PROcontrol PROftpclient PROjscript PROmailer PROperl PROperlCHAT PROphp PROphpLesson PROphpLesson2 PROphpLesson3 PROphpfunction PROphpfunctionArray PROphpfunctionMisc PROphpfunctionString PROsql PROvb PROvbFunction PROvbString PROvbdbmtn PROvbonepoint PROwebapp PROwin1POINT PROwinSYSTEM PROwinYOROZU PROwindows ProjectBoard RealPHP ScriptAPP ScriptMaster VBRealtime Vsfuncs a1root access accreq adsi ajax amazon argus asp aspSample aspVarious aspdotnet aw2kinst cappvariety centura ckeyword classStyle cmaterial cmbin cmdbapp cmenum cmlang cmlistbox cmstd cmstdseed cmtxt cs daz3d db dbCommon dbaccess dnettool dos download flex2 flex3 flex4 framemtn framereq freeWorld freesoft gimp ginpro giodownload google hdml home hta htmlDom ie9svg install java javaSwing javascript jetsql jquery jsp jspTest jspVarious lightbox listasp listmsapi listmsie listmsiis listmsnt listmspatch listmsscript listmsvb listmsvc memo ms msde mysql netbeans oraPlsql oracle oracleWiper oraclehelper orafunc other panoramio pear perl personal pgdojo pgdojo_cal pgdojo_holiday pgdojo_idx pgdojo_ref pgdojo_req php phpVarious phpguide plsql postgres ps r205 realC realwebapp regex rgaki ruby rule sboard sc scprint scquest sdb sdbquest seesaa setup sh_Imagick sh_canvas sh_dotnet sh_google sh_tool sh_web shadowbox shgm shjquery shvbs shweb sjscript skadai skywalker smalltech sperl sqlq src systemdoc tcpip tegaki three toolbox twitter typeface usb useXML vb vbdb vbsfunc vbsguide vbsrc vpc wcsignup webanymind webappgen webclass webparts webtool webwsh win8 winofsql wmi work wp youtube