IEView.cpp
资源名称:视频会议系统.rar [点击查看]
上传用户:popouu88
上传日期:2013-02-11
资源大小:2894k
文件大小:4k
源码类别:
IP电话/视频会议
开发平台:
Visual C++
- // IEView.cpp : implementation file
- //
- #include "stdafx.h"
- #include "IE.h"
- #include "IEView.h"
- #include "MainFrame.h"
- #include "mshtml.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CIEView
- CIEView::CIEView()
- {
- ::CoInitialize( NULL );
- this->tab = NULL;
- this->index = 0;
- this->m_bNotify = FALSE;
- this->username = "";
- this->ieid = 0;
- this->curURL = "";
- this->advise = true;
- }
- CIEView::~CIEView()
- {
- }
- BEGIN_MESSAGE_MAP(CIEView, CHtmlView)
- //{{AFX_MSG_MAP(CIEView)
- ON_WM_PARENTNOTIFY()
- ON_WM_TIMER()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CIEView diagnostics
- void CIEView::OnBeforeNavigate2(LPCTSTR lpszURL, DWORD nFlags, LPCTSTR lpszTargetFrameName, CByteArray& baPostedData, LPCTSTR lpszHeaders, BOOL* pbCancel)
- {
- this->advise = true;
- this->SetTimer( 2 , 10000 , NULL );
- CHtmlView::OnBeforeNavigate2(lpszURL, nFlags, lpszTargetFrameName, baPostedData, lpszHeaders, pbCancel);
- }
- void CIEView::OnNavigateComplete2(LPCTSTR strURL)
- {
- CString url = this->GetLocationURL( );
- CMainFrame * frame = this->GetFrame( );
- if( ! url.IsEmpty( ) && this->curURL != url && this->m_bNotify )
- {
- this->curURL = url;
- //恢复不可通知外部程序
- this->m_bNotify = FALSE;
- if( frame && frame->OnIEURL )
- {
- char buffer[ 1000 ];
- char * now = buffer;
- //浏览器id
- *( int * )now = this->ieid; now += sizeof( int );
- //用户名
- strcpy( now , this->username ); now += this->username.GetLength( ) + sizeof( char );
- //然后是地址
- strcpy( now , url );
- //通知外部程序
- frame->OnIEURL( frame->wParam , frame , buffer , sizeof( int ) + this->username.GetLength( ) + sizeof( char ) + url.GetLength( ) + sizeof( char ) );
- }
- }
- // if( frame )
- // frame->GetAddrWnd( ).SetWindowText( strURL );
- CHtmlView::OnNavigateComplete2(strURL);
- }
- void CIEView::OnNewWindow2( LPDISPATCH * ppDisp, BOOL * Cancel )
- {
- * ppDisp = NULL;
- if( this->m_bNotify )
- {
- this->m_bNotify = FALSE;
- CIEView * ieView = this->GetFrame( )->GetView( )->CreateIEView( );
- if( ieView )
- {
- ieView->ieid = ( int )ieView;
- ieView->username = this->GetFrame( )->user_name;
- ieView->m_bNotify = TRUE;
- * ppDisp = ieView->GetApplication( );
- }
- }
- if( * ppDisp == NULL )
- * Cancel = TRUE;
- CHtmlView::OnNewWindow2( ppDisp , Cancel );
- }
- void CIEView::OnTitleChange( LPCTSTR lpszText )
- {
- if( this->tab )
- {
- CString text( lpszText );
- if( text.GetLength( ) > 10 )
- text = text.Left( 8 ) + "...";
- TCITEM item;
- item.mask = TCIF_TEXT;
- item.pszText = ( char * )( const char * )text;
- this->tab->SetItem( this->index , &item );
- }
- }
- void CIEView::OnStatusTextChange(LPCTSTR lpszText)
- {
- this->GetFrame( )->SetStatusText( lpszText );
- CHtmlView::OnStatusTextChange(lpszText);
- }
- void CIEView::OnParentNotify(UINT message, LPARAM lParam)
- {
- CHtmlView::OnParentNotify( message , lParam );
- //鼠标单击
- if( message == WM_LBUTTONDOWN )
- {
- this->m_bNotify = true;
- if( this->advise )
- this->SetTimer( 1 , 10000 , NULL );
- }
- }
- void CIEView::OnTimer(UINT nIDEvent)
- {
- CHtmlView::OnTimer( nIDEvent );
- this->KillTimer( nIDEvent );
- if( nIDEvent == 1 )
- this->m_bNotify = false;
- else if( nIDEvent == 2 )
- this->advise = false;
- }
- void CIEView::OnProgressChange(long nProgress, long nProgressMax)
- {
- if( nProgress == -1 )
- { //更新窗口
- if( this->GetStyle( ) & WS_VISIBLE )
- {
- this->ShowWindow( SW_HIDE );
- this->ShowWindow( SW_SHOW );
- }
- else
- {
- this->ShowWindow( SW_SHOW );
- this->ShowWindow( SW_HIDE );
- }
- }
- CHtmlView::OnProgressChange(nProgress, nProgressMax);
- }