Exemplo n.º 1
0
/*!
	ウインドウを閉じるときに発生。デバイスコンテキストとか確保した画面構造のメモリとかも終了。
	@param[in]	hWnd	親ウインドウのハンドル
	@return		無し
*/
VOID Pvw_OnDestroy( HWND hWnd )
{
	RECT	rect;

	//	ウインドウ位置も記録
	GetWindowRect( ghPrevWnd, &rect );
	rect.right  -= rect.left;
	rect.bottom -= rect.top;
	InitWindowPos( INIT_SAVE , WDP_PREVIEW, &rect );	//	終了時保存

	ghPrevWnd = NULL;

	gpDocument2.Release( );

	gpWebBrowser2.Release( );

	if( hWnd )	PostMessage( ghPrntWnd, WMP_PREVIEW_CLOSE, 0, 0 );

	return;
}
Exemplo n.º 2
0
/*!
	小型MAAテンプレウインドウの作成
	@param[in]	hInstance	アプリのインスタンス
	@param[in]	hParentWnd	メインウインドウのハンドル
	@param[in]	pstFrame	
	@param[in]	hMaaWnd		複数行テンプレのウインドウハンドル
	@return		作ったビューのウインドウハンドル
*/
HWND BrushTmpleInitialise( HINSTANCE hInstance, HWND hParentWnd, LPRECT pstFrame, HWND hMaaWnd )
{
	DWORD		dwExStyle, dwStyle;
	HWND		hPrWnd;
	UINT_PTR	dItems, i;
	TCHAR		atBuffer[MAX_STRING];

	INT		spPos;


	WNDCLASSEX	wcex;
	RECT		wdRect, clRect, rect, cbxRect, tbRect, mtbRect;
	LVCOLUMN	stLvColm;

	//	破壊
	if( !(hInstance) && !(hParentWnd) )
	{

		return NULL;
	}

	ZeroMemory( &wcex, sizeof(WNDCLASSEX) );
	wcex.cbSize			= sizeof(WNDCLASSEX);
	wcex.style			= CS_HREDRAW | CS_VREDRAW;
	wcex.lpfnWndProc	= MmaaTmpleProc;
	wcex.cbClsExtra		= 0;
	wcex.cbWndExtra		= 0;
	wcex.hInstance		= hInstance;
	wcex.hIcon			= NULL;
	wcex.hCursor		= LoadCursor(NULL, IDC_ARROW);
	wcex.hbrBackground	= (HBRUSH)(COLOR_WINDOW+1);
	wcex.lpszMenuName	= NULL;
	wcex.lpszClassName	= MINITEMPLATE_CLASS;
	wcex.hIconSm		= NULL;

	gMnTmplAtom = RegisterClassEx( &wcex );

	ghMainWnd = hParentWnd;

//テンプレデータ読み出し
//	TemplateItemLoad( AA_BRUSH_FILE, BrushTmpleItemData );


	InitWindowPos( INIT_LOAD, WDP_MMAATPL, &rect );
	if( 0 == rect.right || 0 == rect.bottom )	//	幅高さが0はデータ無し
	{
		GetWindowRect( hParentWnd, &wdRect );
		rect.left   = wdRect.right + 64;
		rect.top    = wdRect.top + 64;
		rect.right  = MT_WIDTH;
		rect.bottom = MT_HEIGHT;
		InitWindowPos( INIT_SAVE , WDP_MMAATPL, &rect );	//	起動時保存
	}

	if( gbTmpltDock )
	{
		spPos = grdSplitPos - SPLITBAR_WIDTH;	//	右からのオフセット

		hPrWnd    = hParentWnd;
		dwExStyle = 0;
		dwStyle   = WS_CHILD;

		rect = *pstFrame;	//	クライヤントに使える領域
		rect.left  = rect.right - spPos;
		rect.right = PLIST_DOCK;
		rect.bottom >>= 1;
		rect.top    += rect.bottom;

		DockingTabSizeGet( &mtbRect );
		rect.top    += mtbRect.bottom;
		rect.bottom -= mtbRect.bottom;
	}
	else
	{
Exemplo n.º 3
0
/*!
	ウインドウを作成
	@param[in]	iNowPage	プレビュりたい頁番号
	@param[in]	bForeg		非0なら再プレビューのときにフォアグランドにする・0ならしない・プレビュー開いてないなら何もしない
	@return	HRESULT	終了状態コード
*/
HRESULT PreviewVisibalise( INT iNowPage, BOOLEAN bForeg )
{
	HWND	hWnd;
	TCHAR	atBuffer[MAX_STRING];
//	UINT	iIndex;
	RECT	rect;
	RECT	tbRect;

	HRESULT	hRslt;

	CComPtr<IUnknown>	comPunkIE;	
	CComPtr<IDispatch>	pDispatch;
	CComVariant	vEmpty;
	CComVariant	vUrl( TEXT("about:blank") );

#ifdef REDRAW_ATSCROLL
	LONG	height, offhei, scrtop;
//	CComQIPtr<IHTMLWindow2>		pWindow2;
	CComQIPtr<IHTMLElement>		pElement;
	CComQIPtr<IHTMLElement2>	pElement2;
#endif

	if( ghPrevWnd )	//	已にPreview窓有ったら
	{
	//	SendMessage( ghToolWnd, TB_CHECKBUTTON, IDM_PVW_ALLVW, FALSE );

#pragma message ("全プレ書換時に、スクロールバーの位置覚えておいて、そこまでScrollさせる?")

#ifdef REDRAW_ATSCROLL
		gpWebBrowser2->get_Height( &height );	//	多分コンポーネントの高さ

		gpDocument2->get_body( &pElement );
		pElement.QueryInterface( &pElement2 );
		pElement.Release(  );

		pElement2->get_scrollHeight( &offhei );	//	全体の高さ
		pElement2->get_scrollTop( &scrtop );	//	表示位置のスクロール量
		pElement2.Release(  );

#endif

		//	内容書き換え
		if( 0 > giViewMode ){	PreviewPageWrite(  -1 );	}
		else{	PreviewPageWrite( iNowPage );	}

		gpWebBrowser2->Refresh(  );

#ifdef REDRAW_ATSCROLL
		gpDocument2->get_body( &pElement );
		pElement.QueryInterface( &pElement2 );
		pElement.Release(  );

		pElement2->get_scrollHeight( &offhei );	//	全体の高さ

		pElement2->put_scrollTop(  scrtop );	//	表示位置のスクロール量
		pElement2.Release(  );
#endif

		InvalidateRect( ghPrevWnd, NULL, TRUE );

		if( bForeg )	SetForegroundWindow( ghPrevWnd );

		return S_FALSE;
	}

	//	プレビュー開いてないときに、非フォアグランドなら何もしない
	if( !(bForeg) ){	return  E_ABORT;	}


	InitWindowPos( INIT_LOAD, WDP_PREVIEW, &rect );
	if( 0 >= rect.right || 0 >= rect.bottom )	//	幅高さが0はデータ無し
	{
		hWnd = GetDesktopWindow( );
		GetWindowRect( hWnd, &rect );
		rect.left   = ( rect.right  - PVW_WIDTH ) / 2;
		rect.top    = ( rect.bottom - PVW_HEIGHT ) / 2;
		rect.right  = PVW_WIDTH;
		rect.bottom = PVW_HEIGHT;
		InitWindowPos( INIT_SAVE , WDP_PREVIEW, &rect );	//	起動時保存
	}


	ghPrevWnd = CreateWindowEx( WS_EX_TOOLWINDOW, DOC_PREVIEW_CLASS, TEXT("IEコンポーネントによるプレビュー"),
		WS_POPUP | WS_THICKFRAME | WS_CAPTION | WS_VISIBLE | WS_SYSMENU,
		rect.left, rect.top, rect.right, rect.bottom, NULL, NULL, ghInst, NULL );

	//ツールバー作る
	ghToolWnd = CreateWindowEx( 0, TOOLBARCLASSNAME, TEXT("toolbar"),
		WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TOOLTIPS | CCS_NODIVIDER,
		0, 0, 0, 0, ghPrevWnd, (HMENU)IDW_PVW_TOOL_BAR, ghInst, NULL );

	//	自動ツールチップスタイルを追加
	SendMessage( ghToolWnd, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS );

	SendMessage( ghToolWnd, TB_SETIMAGELIST, 0, (LPARAM)ghPrevwImgLst );

	SendMessage( ghToolWnd, TB_SETBUTTONSIZE, 0, MAKELPARAM(16,16) );

	SendMessage( ghToolWnd, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0 );
	//	ツールチップ文字列を設定・ボタンテキストがツールチップになる
	StringCchCopy( atBuffer, MAX_STRING, TEXT("全プレビュースタイル") );	gstTBInfo[0].iString = SendMessage( ghToolWnd, TB_ADDSTRING, 0, (LPARAM)atBuffer );

	SendMessage( ghToolWnd , TB_ADDBUTTONS, (WPARAM)TB_ITEMS, (LPARAM)&gstTBInfo );	//	ツールバーにボタンを挿入

	SendMessage( ghToolWnd , TB_AUTOSIZE, 0, 0 );	//	ボタンのサイズに合わせてツールバーをリサイズ
	InvalidateRect( ghToolWnd , NULL, TRUE );		//	クライアント全体を再描画する命令

	//	ツールバーサブクラス化が必要

	GetWindowRect( ghToolWnd, &tbRect );
	tbRect.right  -= tbRect.left;
	tbRect.bottom -= tbRect.top;
	tbRect.left = 0;
	tbRect.top  = 0;

	GetClientRect( ghPrevWnd, &rect );
	rect.top     = tbRect.bottom;
	rect.bottom -= tbRect.bottom;

	AtlAxWinInit(  );

	ghIEwnd = CreateWindowEx( 0, ATL_AX_WIN, TEXT("Shell.Explorer.2"),
		WS_CHILD | WS_VISIBLE, rect.left, rect.top, rect.right, rect.bottom,
		ghPrevWnd, (HMENU)IDW_PVW_VIEW_WNDW, ghInst, NULL );

	//	ActiveXコントロールのインターフェースを要求
	if( SUCCEEDED( AtlAxGetControl( ghIEwnd, &comPunkIE ) ) )
	{
		gpWebBrowser2 = comPunkIE;	//	ポインタに格納

		if( gpWebBrowser2 )
		{
			gpWebBrowser2->Navigate2( &vUrl, &vEmpty, &vEmpty, &vEmpty, &vEmpty );

			while( 1 )
			{
				hRslt = gpWebBrowser2->get_Document( &pDispatch );
				if( SUCCEEDED(hRslt) && pDispatch )
				{
					gpDocument2 = pDispatch;
					if( gpDocument2 ){	hRslt = S_OK;	break;	}
				}
				Sleep(100);
			}
		}
		else
		{
			NotifyBalloonExist( TEXT("IEコンポーネントを初期化出来なかったよ・・・"), TEXT("お燐からのお知らせ"), NIIF_ERROR );
			hRslt = E_ACCESSDENIED;
		}
	}

	if( SUCCEEDED(hRslt)  ){	PreviewPageWrite( iNowPage );	}

	UpdateWindow( ghPrevWnd );

	return hRslt;
}
Exemplo n.º 4
0
/*!
	壱行テンプレウインドウの作成
	@param[in]	hInstance	アプリのインスタンス
	@param[in]	hParentWnd	親ウインドウのハンドル
	@param[in]	pstFrame	メインクライヤント領域
	@return		作ったビューのウインドウハンドル
*/
HWND LineTmpleInitialise( HINSTANCE hInstance, HWND hParentWnd, LPRECT pstFrame )
{

	WNDCLASSEX	wcex;
	RECT		wdRect, clRect, rect, cbxRect;
	UINT_PTR	dItems, i;
	DWORD		dwExStyle, dwStyle;
	HWND		hPrWnd;
	INT			spPos;

	TTTOOLINFO	stToolInfo;
	LVCOLUMN	stLvColm;


	ZeroMemory( &wcex, sizeof(WNDCLASSEX) );
	wcex.cbSize			= sizeof(WNDCLASSEX);
	wcex.style			= CS_HREDRAW | CS_VREDRAW;
	wcex.lpfnWndProc	= LineTmpleProc;
	wcex.cbClsExtra		= 0;
	wcex.cbWndExtra		= 0;
	wcex.hInstance		= hInstance;
	wcex.hIcon			= NULL;
	wcex.hCursor		= LoadCursor(NULL, IDC_ARROW);
	wcex.hbrBackground	= (HBRUSH)(COLOR_WINDOW+1);
	wcex.lpszMenuName	= NULL;
	wcex.lpszClassName	= LINETEMPLATE_CLASS;
	wcex.hIconSm		= NULL;

	gTmpleAtom = RegisterClassEx( &wcex );

//テンプレデータ読み出し
	TemplateItemLoad( AA_LIST_FILE, LineTmpleItemData );


	InitWindowPos( INIT_LOAD, WDP_LNTMPL, &rect );
	if( 0 == rect.right || 0 == rect.bottom )	//	幅高さが0はデータ無し
	{
		GetWindowRect( hParentWnd, &wdRect );
		rect.left   = wdRect.right;
		rect.top    = wdRect.top;
		rect.right  = LT_WIDTH;
		rect.bottom = LT_HEIGHT;
		InitWindowPos( INIT_SAVE, WDP_LNTMPL, &rect );//起動時保存
	}

	//	カラム数確認
	gLnClmCnt = InitParamValue( INIT_LOAD, VL_LINETMP_CLM, 4 );

	if( gbTmpltDock )
	{
		spPos = grdSplitPos - SPLITBAR_WIDTH;	//	右からのオフセット

		hPrWnd    = hParentWnd;
		dwExStyle = 0;
		dwStyle   = WS_CHILD | WS_VISIBLE;

		rect = *pstFrame;	//	クライヤントに使える領域
		rect.left  = rect.right - spPos;
		rect.right = PLIST_DOCK;
		rect.bottom >>= 1;
		rect.top    += rect.bottom;

		//	ブラシと切換タブを作成
		ghDockTabWnd = DockingTabCreate( hInstance, hPrWnd, &rect );
	}
	else
	{