⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myieview.cpp

📁 myie的源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:

		*ppDisp = pWnd->m_pView->GetApplication();
	}

	if(*ppDisp != NULL)
		*Cancel = FALSE;

	}
/*	catch(CMemoryException* e)
	{
//		AfxMessageBox("new window error");
		*Cancel=TRUE;
		if(e!=NULL)e->Delete();
	}*/
	catch(...)
	{
	}

 	//CFixedHtmlView::OnNewWindow2(ppDisp, Cancel);
	
}





void CMyIEView::OnProgressChange(long nProgress, long nProgressMax) 
{
	// TODO: Add your specialized code here and/or call the base class
	try{

	int oldp = m_nProgress;
	if(nProgressMax>0 && nProgress>=0 && nProgressMax/100>0)
	{
		m_nProgress  = nProgress/(nProgressMax/100);
		if(m_nProgress>100)
			m_nProgress=100;
	}
	else
	{
		m_nProgress = -10;
//b5
//		CString strUrl2;
//		GetLocationURL(strUrl2);
//		if((strUrl2 != "" && !strUrl2.IsEmpty()))
//			m_lpszUrl = strUrl2;
	}

	if(IsActive)
		percent = m_nProgress;

	if(IsActive && m_bUseAutoScroll )
	{	

		//start to scroll
		if(m_nScrollTimer==0 && m_bUseAutoScroll && m_nSrSpeed!=0)
		{
			if(m_nProgress==100 || m_nProgress<0 || (!m_bScrollAfterDL && m_nProgress>=20))
			{
//				m_nScrollTimer = SetTimer(2132, (UINT)(1000*gSeed/m_nSrSpeed), NULL);
				m_nScrollTimer = SetTimer(2132, (UINT)((26 + gSeed * 100)/m_nSrSpeed), NULL);
			}
		}
		else if(m_nScrollTimer && m_nProgress<20 && m_nProgress>0)
		{
			//stop the timer;
			if(m_nScrollTimer)
				KillTimer(m_nScrollTimer);
			m_nScrollTimer = 0;

		}

	}


	//set icon
	if(pMainFrame!=NULL)
	{
		int nIcon = m_nProgress/25;
		int oi = oldIcon;
		if(m_nProgress<0)
			nIcon=-1;
		if(nIcon==4)
			nIcon=3;

		if((m_nProgress>=0 && nIcon != oi) || m_nProgress<0)
		{
			int nTabID;
			nTabID = ((CMainFrame*)pMainFrame)->FindTab((CChildFrame*)GetParentFrame());
			if(m_nProgress>=0 && nIcon != oi)
				oldIcon = ((CMainFrame*)pMainFrame)->SetTabIcon( nIcon, nTabID );
			else if(m_nProgress<0)
			{
				if(!IsActive)
					oldIcon = ((CMainFrame*)pMainFrame)->SetTabIcon( 5, nTabID );
				else if(((CChildFrame*)GetParentFrame())->bLock)
					oldIcon = ((CMainFrame*)pMainFrame)->SetTabIcon( 4, nTabID );
				else if(((CChildFrame*)GetParentFrame())->bProtect)
					oldIcon = ((CMainFrame*)pMainFrame)->SetTabIcon( 6, nTabID );
				else
					oldIcon = ((CMainFrame*)pMainFrame)->SetTabIcon( -1, nTabID );
			}

			//update tab bar
			if(m_nProgress*oldp<=0 && oi*oldIcon<=0 && oldIcon != oi)
				pMainFrame->PostMessage(WM_UPDATE_TAB);
		}
	}

	}/*catch(CException * e)
	{
		if(e!=NULL)e->Delete();
	//	AfxMessageBox("progress error");
	}*/
	catch(...)
	{
	}

//	CFixedHtmlView::OnProgressChange(nProgress, nProgressMax);
}


void CMyIEView::OnEditCopy() 
{
	// TODO: Add your command handler code here
	ExecWB(OLECMDID_COPY, OLECMDEXECOPT_DONTPROMPTUSER,
	   NULL, NULL);

}

void CMyIEView::OnEditCut() 
{
	// TODO: Add your command handler code here
	ExecWB(OLECMDID_CUT, OLECMDEXECOPT_DONTPROMPTUSER,
	   NULL, NULL);

}

void CMyIEView::OnEditFind() 
{
	// TODO: Add your command handler code here
	((CMainFrame*)pMainFrame)->ExecCmdTarget(HTMLID_FIND, this);
}

void CMyIEView::OnEditPaste() 
{
	// TODO: Add your command handler code here
	ExecWB(OLECMDID_PASTE, OLECMDEXECOPT_DONTPROMPTUSER,
	   NULL, NULL);
	
}

void CMyIEView::OnEditSelectAll() 
{
	// TODO: Add your command handler code here
	ExecWB(OLECMDID_SELECTALL, OLECMDEXECOPT_DONTPROMPTUSER,
	   NULL, NULL);
	
}

void CMyIEView::OnStatusTextChange(LPCTSTR lpszText) 
{
	// TODO: Add your specialized code here and/or call the base class
	try
	{
	if(IsActive && pMainFrame!=NULL)
	{
		if(bURLOnly && lpszText!=NULL && strlen(lpszText)!=0)
		{
			char* pdes = strstr(lpszText, "about:");
			if(pdes!=lpszText)
			{
				pdes = strstr(lpszText, "://");
				if(pdes == NULL)
				{
					pdes = strstr(lpszText, "mailto:");
					if(pdes == NULL)
					{
						pdes = strstr(lpszText, "javascript:");
					}
				}
			}
			int pos =0;
			if(pdes != NULL)
			{
				pos = pdes - lpszText;
			}
			if((pdes==NULL || pos>10 ) 
				&& strncmp(lpszText,"Shortcut", 8)!=0 && strstr(lpszText, "的快捷方式")==NULL && strstr(lpszText, "地址已")==NULL && strcmp(lpszText, "Done")!=0
				&& strncmp(lpszText, "正在", 4)!=0 && strncmp(lpszText, "完成", 4)!=0 && strstr(lpszText, "项剩余")==NULL 
				&& strncmp(lpszText, "Wait", 4)!=0 && strncmp(lpszText, "Start", 5)!=0 && strncmp(lpszText, "Open", 4)!=0 && strncmp(lpszText, "Connect", 7)!=0 && strncmp(lpszText,"Find",4)!=0 && strncmp(lpszText, "download", 8)!=0 && strncmp(lpszText, "Web", 3)!=0 && strstr(lpszText, "remain")==NULL)
				return;
		}
		if( !( ((CMainFrame*)pMainFrame)->m_bStatusBlank && lpszText!=NULL && strlen(lpszText)==0))
			pMainFrame->SetMessageText(lpszText);
		if(strlen(lpszText)==0)
			((CMainFrame*)pMainFrame)->m_bStatusBlank = TRUE;
		else
			((CMainFrame*)pMainFrame)->m_bStatusBlank = FALSE;

	}
	}/*catch(CException * e)
	{
		if(e!=NULL)e->Delete();
//		AfxMessageBox("status text error");
	}*/
	catch(...)
	{
	}
}

BOOL CMyIEView::OnAmbientProperty(COleControlSite* pSite, DISPID dispid, VARIANT* pvar) 
{
	// TODO: Add your specialized code here and/or call the base class
	if (dispid == DISPID_AMBIENT_DLCONTROL)
	{
//	  dwProperty |= DLCTL_SILENT;
//	  if(!bSilent)
//		  dwProperty -= DLCTL_SILENT;

	  pvar->vt = VT_I4;
	  pvar->lVal = dwProperty; 
	  //DLCTL_DLIMAGES  | DLCTL_NO_SCRIPTS | DLCTL_NO_JAVA
	//				 | DLCTL_NO_RUNACTIVEXCTLS | DLCTL_NO_DLACTIVEXCTLS;
	  return TRUE;

	}


	return CFixedHtmlView::OnAmbientProperty(pSite, dispid, pvar);
	

}

void CMyIEView::OnOptionsLoadimage() 
{
	// TODO: Add your command handler code here
	dwProperty ^= DLCTL_DLIMAGES;
//	m_bForceRefresh = TRUE;
	ChangeProperty();
	Refresh();
}

void CMyIEView::OnUpdateOptions(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	try
	{

	switch (pCmdUI->m_nID)
	{
	case ID_OPTIONS_LOADIMAGE:
	/*	if(dwProperty&DLCTL_DLIMAGES)
			pCmdUI->SetCheck(1);
		else
			pCmdUI->SetCheck(0);*/
		((CMainFrame*)pMainFrame)->ToolBarSetCheck(pCmdUI, dwProperty&DLCTL_DLIMAGES);
		/*
		if(dwProperty&DLCTL_DLIMAGES)
		{
			if(((CMainFrame*)pMainFrame)->m_strBGPic == "" || pCmdUI->m_pMenu !=NULL)
				pCmdUI->SetCheck();
			else
			{
				pCmdUI->SetCheck(0);
				((CMainFrame*)pMainFrame)->m_wndToolBar.GetToolBarCtrl().PressButton(pCmdUI->m_nID, TRUE);
			}
		}
		else
		{
			((CMainFrame*)pMainFrame)->m_wndToolBar.GetToolBarCtrl().PressButton(pCmdUI->m_nID, FALSE);
			pCmdUI->SetCheck(0);
		}*/
		break;
	case ID_OPTIONS_LOADVIDEOS:
		if(dwProperty&DLCTL_VIDEOS)
			pCmdUI->SetCheck(1);
		else
			pCmdUI->SetCheck(0);
		break;
	case ID_OPTIONS_LOADSOUNDS:
		if(dwProperty&DLCTL_BGSOUNDS)
			pCmdUI->SetCheck(1);
		else
			pCmdUI->SetCheck(0);
		break;
	case ID_OPTIONS_ALLOWSCRIPTS:
		if(dwProperty&DLCTL_NO_SCRIPTS)
			pCmdUI->SetCheck(0);
		else
			pCmdUI->SetCheck(1);
		break;
	case ID_OPTIONS_ALLOWJAVAAPPLET:
		if(dwProperty&DLCTL_NO_JAVA)
			pCmdUI->SetCheck(0);
		else
			pCmdUI->SetCheck(1);
		break;
	case ID_OPTIONS_ALLOWACTIVEX:
		if(dwProperty&DLCTL_NO_RUNACTIVEXCTLS)
			pCmdUI->SetCheck(0);
		else
			pCmdUI->SetCheck(1);
		break;
	}

	}
	catch(...)
	{
	//	AfxMessageBox("update option error");
	}

}

void CMyIEView::OnOptionsAllowscripts() 
{
	// TODO: Add your command handler code here
	dwProperty ^= DLCTL_NO_SCRIPTS;
	ChangeProperty();
	Refresh();

}

void CMyIEView::OnOptionsLoadsounds() 
{
	// TODO: Add your command handler code here
	dwProperty ^= DLCTL_BGSOUNDS;
	ChangeProperty();
	Refresh();
	
}

void CMyIEView::OnOptionsLoadvideos() 
{
	// TODO: Add your command handler code here
	dwProperty ^= DLCTL_VIDEOS;
	ChangeProperty();
	
}

void CMyIEView::OnOptionsUseWebp() 
{
	// TODO: Add your command handler code here
	if(m_bEnWebProxy)
		m_bEnWebProxy = FALSE;
	else
	{
		m_bEnWebProxy = TRUE;
		//auto refresh
		if(!m_lpszUrl.IsEmpty() && m_lpszUrl!="about:blank")
		{
			ToNavigate(m_lpszUrl, 0, NULL, NULL, NULL, 0, TRUE);
		}
	}
}

void CMyIEView::OnUpdateOptionsUseWebp(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	try
	{
		((CMainFrame*)pMainFrame)->ToolBarSetCheck(pCmdUI, m_bEnWebProxy);
	}
	catch(...)
	{
	}
	/*
	if(m_bEnWebProxy)
	{
		if(((CMainFrame*)pMainFrame)->m_strBGPic == "" || pCmdUI->m_pMenu !=NULL)
			pCmdUI->SetCheck();
		else
		{
			pCmdUI->SetCheck(0);
			((CMainFrame*)pMainFrame)->m_wndToolBar.GetToolBarCtrl().PressButton(pCmdUI->m_nID, TRUE);
		}
	}
	else
	{
		((CMainFrame*)pMainFrame)->m_wndToolBar.GetToolBarCtrl().PressButton(pCmdUI->m_nID, FALSE);
		pCmdUI->SetCheck(0);
	}*/

}

void CMyIEView::OnOptionsAllowactivex() 
{
	// TODO: Add your command handler code here
	dwProperty ^= DLCTL_NO_RUNACTIVEXCTLS;
	ChangeProperty();

}

void CMyIEView::OnOptionsAllowjavaapplet() 
{
	// TODO: Add your command handler code here
	dwProperty ^= DLCTL_NO_JAVA;
	ChangeProperty();

}


void CMyIEView::OnCommandStateChange(long nCommand, BOOL bEnable) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(nCommand == 2)
		m_back = bEnable;
	else if(nCommand == 1)
		m_forward = bEnable;

	//	CFixedHtmlView::OnCommandStateChange(nCommand, bEnable);
}

void CMyIEView::OnUpdateGoBack(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	try{
	pCmdUI->Enable(m_back);
	}catch(...)
	{
	}
}

void CMyIEView::OnUpdateGoForward(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	try{
	pCmdUI->Enable(m_forward);
	}catch(...)
	{
	}

}




/*BOOL CMyIEView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	if (CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
		return TRUE;

	return FALSE;
}*/

void ResizeSibling(CMyIEView* pvw)
{
	try{
	m_bMax = 0;
	CChildFrame* tcf;
	CRect oldrect,rect;
	if(pMainFrame!=NULL)
	{
		int n = ((CMainFrame*)pMainFrame)->m_wndTab.GetItemCount();
		TCITEM TabCtrlItem;
		TabCtrlItem.mask = TCIF_PARAM;

		for(int i=n-1;i>=0;i--)
		{
			((CMainFrame*)pMainFrame)->m_wndTab.GetItem(i, &TabCtrlItem);
			tcf = ((CChildFrame*)TabCtrlItem.lParam);
			if(tcf != NULL && tcf->m_pView!=NULL)
			{
				if(tcf->m_pView != pvw)
				{
					tcf->GetClientRect(&rect);
					tcf->m_pView->m_wndBrowser.GetWindowRect(&oldrect);
					tcf->m_pView->ScreenToClient(&oldrect);
					if(oldrect.left != -BORDER && oldrect.top != -BORDER)
					{
						try{
						tcf->m_pView->m_wndBrowser.MoveWindow(-2,-2, rect.Width()+BORDER+BORDER, rect.Height()+BORDER+BORDER);
						}catch(...)
						{
						}
					}
					else
					{
						try{
						if(oldrect.Width()!=rect.Width()+BORDER+BORDER && rect.Width()!=0)
							tcf->m_pView->SetWidth (rect.Width()+BORDER+BORDER);
						if(oldrect.Height()!=rect.Height()+BORDER+BORDER && rect.Height()!=0)
							tcf->m_pView->SetHeight (rect.Height()+BORDER+BORDER);
						}catch(...)
						{
						}
					}
				}
			}
		}
	}

	}/*catch(CMemoryException * e)
	{
		if(e!=NULL)e->Delete();
//		AfxMessageBox("resize sibling error");
	}*/
	catch(...)
	{
	}

}


void CMyIEView::OnSize(UINT nType, int cx, int cy) 
{
//	if (nType != SIZE_MINIMIZED )
	try{
		if(m_bMax==1)
		{
			if(GetParentFrame()->IsZoomed())
			{
				CRect oldrect;
				m_wndBrowser.GetWindowRect(&oldrect);
				ScreenToClient(&oldrect);
/*				if(oldrect.Width()!=cx+4 && oldrect.Height()!=cy+4)
					m_wndBrowser.MoveWindow(-2,-2, cx+4, cy+4);
				else if(oldrect.Width()!=cx+4 )
					m_wndBrowser.SetWidth (cx+4);
				else if(oldrect.Height()!=cy+4)
					m_wndBrowser.SetHeight (cy+4);*/
				if(oldrect.left != -BORDER && oldrect.top != -BORDER)
				{
					try{
					m_wndBrowser.MoveWindow(-2,-2, cx+BORDER+BORDER, cy+BORDER+BORDER);
					}catch(...)
					{
					}
				}
				else
				{
					try{
					if(oldrect.Width()!=cx+BORDER+BORDER )
						SetWidth (cx+BORDER+BORDER);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -