class LboxWin : public LboxWintool,public LboxInfo


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




このクラスはトップレベルウインドウを想定しています

  

// *********************************************************
//  
// *********************************************************
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch( message ) {
		case WM_CREATE:
			Win = new LboxWin( hWnd );
			Win->StatusCreate( ID_STATUS );
			Win->ScreenFit( );
			break;

		case WM_SIZE:
			Win->StatusFit( wParam, lParam );
			break;

		case WM_DESTROY:
			delete Win;

			PostQuitMessage( 0 );
			break;

		default:
			return DefWindowProc( hWnd, message, wParam, lParam );
	}
	return 0;
}
  

  コンストラクタ




  

// *********************************************************
// デフォルトコンストラクタ
// *********************************************************
LboxWin::LboxWin()
{
	LboxWin::hWnd = NULL;
	LboxWin::hStatus = NULL;
	LboxWintool::hWndtool = NULL;
}

// *********************************************************
// 拡張コンストラクタ
// *********************************************************
LboxWin::LboxWin( HWND hWindow )
{
	LboxWin::hWnd = hWindow;
	LboxWin::hStatus = NULL;
	LboxWintool::hWndtool = hWindow;
}

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

  ScreenFit

  

// *********************************************************
// スクリーンサイズにフィットさせる
// 戻り値 : 無し
// *********************************************************
void LboxWin::ScreenFit( void )
{
	HWND hDesktop;
	RECT rt;

	hDesktop = GetDesktopWindow( );
	GetWindowRect( hDesktop, &rt );
	LboxWin::MoveWindow( 0, 0 );
	LboxWin::ChangeWindowSize( rt.right, rt.bottom - 32 );

}
  

  StatusCreate

  

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

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

  StatusSetText

  

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

  StatusFit

  

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

  GetHeight

  

// *********************************************************
// 指定したウインドウの高さを取得する
// 戻り値 : 高さ
// *********************************************************
int LboxWin::GetHeight( HWND hTarget )
{
	RECT rt;
	GetWindowRect( hTarget, &rt );
	return ( rt.bottom - rt.top );
}
  

  GetWidth

  

// *********************************************************
// 指定したウインドウの幅を取得する
// 戻り値 : 幅
// *********************************************************
int LboxWin::GetWidth( HWND hTarget )
{
	RECT rt;
	GetWindowRect( hTarget, &rt );
	return ( rt.right - rt.left );
}
  

  CenterWindow

  

// *********************************************************
// ウインドウをデスクトップ中央に移動
// 戻り値 : 無し
// *********************************************************
void LboxWin::CenterWindow( void )
{
	LboxCenterWindow( LboxWin::hWnd );
}
  

LboxCenterWindow

  Minimize

  

// *********************************************************
// ウインドウの最小化
// 戻り値 : 無し
// *********************************************************
void LboxWin::Minimize( void )
{
	CloseWindow(
		LboxWin::hWnd
	);
}
  

  Maximize

  

// *********************************************************
// ウインドウの最大化
// 戻り値 : 無し
// *********************************************************
void LboxWin::Maximize( void )
{
	ShowWindow(
		LboxWin::hWnd,
		SW_MAXIMIZE
	);
}
  

  Restore

  

// *********************************************************
// ウインドウの復帰
// 戻り値 : 無し
// *********************************************************
void LboxWin::Restore( void )
{
	ShowWindow(
		LboxWin::hWnd,
		SW_RESTORE
	);
}
  

  Close

  

// *********************************************************
// WM_CLOSE メッセージのポスト
// 戻り値 : 処理の結果
// *********************************************************
LRESULT LboxWin::Close( void )
{
	return PostMessage(
		LboxWin::hWnd,
		WM_CLOSE,
		0L,
		0L
	);
}
  

  IsMaximize

  

// *********************************************************
// 最大化されているかどうか
// 戻り値 : true 最大化, false 最大化されていない
// *********************************************************
BOOL LboxWin::IsMaximize( void )
{
	BOOL bRet;

	bRet = IsZoomed( LboxWin::hWnd );
	if ( bRet == 0 ) {
		return false;
	}
	else {
		return true;
	}
}
  

  IsMinimize

  

// *********************************************************
// 最小化されているかどうか
// 戻り値 : true 最小化, false 最小化されていない
// *********************************************************
BOOL LboxWin::IsMinimize( void )
{
	BOOL bRet;

	bRet = IsIconic( LboxWin::hWnd );
	if ( bRet == 0 ) {
		return false;
	}
	else {
		return true;
	}
}
  

  GetTitle, SetTitle

  

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

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

  StatusGetText

  

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

  StatusPrintf

  

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

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

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

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

	delete [] szBuffer;
}
  

  ChangeIcon

  

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




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


[cmstd]
claudebot
24/03/29 22:59:13
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