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

📄 myie.cpp

📁 1.MyIE开源工程协议 MyIE开源工程遵循GNU通用公共许可证GPL(GNU General Public License)开发,任何人都可以永久免费安装使用,在你下载和使用MyIE源代码前,请
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	//
	pmf->m_bUseUrlFilter = GetProfileInt("Settings", "UseUrlFilter", TRUE);
	pmf->m_bUseDialogFilter = GetProfileInt("Settings", "UseDialogFilter", TRUE);
	pmf->m_bUseFlyingFilter = GetProfileInt("Settings", "UseFlyingFilter", TRUE);
	if (pmf->m_bUseFlyingFilter)
		pmf->RefreshKillFlyingCode();
	//
	pmf->m_bKillBlank = GetProfileInt("Filter", "KillBlank", TRUE);
	pmf->m_strBlankContent = GetProfileString("Filter", "BlankContent", "<AD>");
	if (pmf->m_bKillBlank)
		pmf->RefreshKillBlankCode();
	//
	pmf->m_bReloadUnShownImage = GetProfileInt("Settings", "ReloadUnShownImage", TRUE);
	//
	pmf->m_nEnableFilter = GetProfileInt("Settings", "EnableFilter", 0xF);
	//window pos
	int top = GetProfileInt("Settings", "top", 50);
	int left = GetProfileInt("Settings", "left", 50);
	int width = GetProfileInt("Settings", "width", 700);
	int height = GetProfileInt("Settings", "height", 500);
	if( width!=0 && top<2000 && top>=-20)
		m_pMainWnd->SetWindowPos(&CWnd::wndTop, left, top, width, height,SWP_HIDEWINDOW);   
	if( GetProfileInt("Settings", "Zoomed", 1))
		m_nCmdShow = SW_SHOWMAXIMIZED;

	pmf->m_nTitleLen = GetProfileInt("Settings", "TabSize", 20);

	//load defaul proxy
	pmf->GetIeProxy();
	pmf->m_bEnProxy = GetProfileInt("Settings", "EnableProxy", 0);
	pmf->m_strCurProxy = GetProfileString("Settings", "CurrentProxy", NULL);
	pmf->m_strCurProxyName = GetProfileString("Settings", "CurrentProxyName", NULL);//pmf->GetProxyName(pmf->m_strCurProxy);
	pmf->m_strProxyByPass = GetProfileString("Settings", "ProxyByPass", "<local>");
	pmf->UpdateProxy();
	
	//load defaul web proxy
	pmf->m_strDefaultWebProxy = GetProfileString("Settings", "DefaultWebProxy", NULL);
	//active new window
	pmf->m_bActiveNewWindow = GetProfileInt("Settings", "ActiveNew", 0);
	//
	pmf->m_bOpenFolderOut = GetProfileInt("Settings", "OpenFolderOut", TRUE);
	//the start favorite folder
	pmf->m_strStartFavFolder = GetProfileString("Settings", "StartFolder", NULL);
	//insert to next tab
	pmf->m_nNewSequence = GetProfileInt("Settings", "NewSequence", 1);
	
	//autosizing tab
	pmf->m_bAutoTab = GetProfileInt("Settings", "AutoTab", 1);

	//max autosizing tab width
	pmf->m_nMaxTabWidth = GetProfileInt("Settings", "MaxTabWidth", 100);
	//min autosizing tab width
	pmf->m_nMinTabWidth = GetProfileInt("Settings", "MinTabWidth", 50);
	//
	g_bShowIndex = GetProfileInt("Settings","ShowIndex", TRUE);
	g_bShowIndex = GetProfileInt("Settings","ShowIndex", TRUE);
	g_bShowDot = GetProfileInt("Settings","ShowDot", TRUE);
	g_bShowRead = GetProfileInt("Settings","ShowRead", TRUE);
	g_bShowFavIcon = GetProfileInt("Settings","ShowFavIcon", TRUE);

	//silent
	g_bSilent = GetProfileInt("Settings", "Silent", TRUE);
	if (g_bSilent != (_RegGetString(HKEY_CURRENT_USER, 
		"Software\\Microsoft\\Internet Explorer\\Main",
		"Disable Script Debugger") == "yes" ? TRUE : FALSE))
	{
		if (g_bSilent)
			_RegSetString(HKEY_CURRENT_USER, 
				"Software\\Microsoft\\Internet Explorer\\Main",
				"Disable Script Debugger",
				"yes");
		else
			_RegSetString(HKEY_CURRENT_USER, 
				"Software\\Microsoft\\Internet Explorer\\Main",
				"Disable Script Debugger",
				"no");
	}
	//default font size
	g_nDefFontSize = GetProfileInt("Settings", "DefFontSize", 2);
	//disable scroll text on status bar
	g_bDisScrollText = GetProfileInt("Settings", "DisScrollText", FALSE);

	//filte blank popup window from same parent
	g_bFilteBlank = GetProfileInt("Settings", "FilteBlank", FALSE);

	//animate icon
	pmf->m_bAnimatIcon = GetProfileInt("Settings", "AnimateIcon", TRUE);

	//lock homepage
	g_bLockHomepage = GetProfileInt("Settings", "LockHomepage", FALSE);

	pmf->m_bDisDownActivex = GetProfileInt("Settings", "DisDownActivex", TRUE);

	//down
	pmf->m_nDownAll = GetProfileInt("Settings", "DownAll", 0);
	//
	pmf->m_nCollectorTrans = GetProfileInt("Settings", "CollectorTrans", 255);
}

void CMyIEApp::SaveConfg()
{
	try{
	//proxy
	if(g_bProxyDirty)
		pmf->m_aProxyCategories.SaveProxies();
	g_bProxyDirty = FALSE;

	//pop filter
	WriteProfileInt("Settings", "KillPop", g_bKillPop);
	WriteProfileInt("Settings", "KillAutoWin", g_bKillAutoWin);
	WriteProfileInt("Settings", "KillDupWin", g_bKillDupWin);
	WriteProfileInt("Settings", "KillListWin", g_bKillListWin);
	//content filter
	WriteProfileInt("Settings", "UseUrlFilter", pmf->m_bUseUrlFilter);
	WriteProfileInt("Settings", "UseFlyingFilter", pmf->m_bUseFlyingFilter);
	WriteProfileInt("Settings", "UseDialogFilter", pmf->m_bUseDialogFilter);
	WriteProfileInt("Settings", "EnableFilter", pmf->m_nEnableFilter);
	//
	WriteProfileInt("Settings", "DisDownActivex", pmf->m_bDisDownActivex);
	//else
	WriteProfileInt("Settings", "TabSize", pmf->m_nTitleLen);

	BYTE *tmp = NULL;
	int i = 1;

	//save defaul web proxy
	WriteProfileString("Settings","DefaultWebProxy", pmf->m_strDefaultWebProxy);
	
	//save defaul  proxy
	WriteProfileString("Settings","CurrentProxy", pmf->m_strCurProxy);
	WriteProfileString("Settings","CurrentProxyName", pmf->m_strCurProxyName);
	WriteProfileString("Settings","ProxyByPass", pmf->m_strProxyByPass);

	//active new
	WriteProfileInt("Settings", "ActiveNew", pmf->m_bActiveNewWindow);
	WriteProfileInt("Settings", "LinkInNewWindow", g_bLinkInNewWindow);
	//start favorite folder
	WriteProfileString("Settings","StartFolder", pmf->m_strStartFavFolder);

	//multiline tab
	WriteProfileInt("Settings", "MultiLineTab", pmf->m_bMultiLineTab);

	//insert to next tab
	WriteProfileInt("Settings", "NewSequence", pmf->m_nNewSequence);

	//Background PIC
	WriteProfileString("Settings", "SkinName", pmf->m_strSkinName);

	//text label
	WriteProfileInt("Settings", "TextLabel", pmf->m_nTextLabel);
	//text label
	WriteProfileInt("Settings", "ColorIcon", pmf->m_bColorIcon);

	//autosizing tab
	WriteProfileInt("Settings","AutoTab", pmf->m_bAutoTab);

	//max autosizing tab width
	WriteProfileInt("Settings","MaxTabWidth", pmf->m_nMaxTabWidth);
	//min autosizing tab width
	WriteProfileInt("Settings","MinTabWidth", pmf->m_nMinTabWidth);
	
	//use shortcut
	WriteProfileInt("Settings","UseSC", pmf->m_bUseSC);

	//use alias
	WriteProfileInt("Settings","UseAlias", pmf->m_bUseAlias);

	//defaut font size
	WriteProfileInt("Settings", "DefFontSize", g_nDefFontSize);
	//!disable scroll text on statusbar
	WriteProfileInt("Settings", "DisScrollText", g_bDisScrollText);

	//toolbar icon
	WriteProfileInt("Settings", "SmallToolbar", pmf->m_bSmallToolBar);

	WriteProfileInt("Settings", "AnimateIcon", pmf->m_bAnimatIcon);
	WriteProfileInt("Settings", "LockHomepage", g_bLockHomepage);
	//lock toolbar
	WriteProfileInt("Settings", "LockToolbar", pmf->m_bLockToolbar);

	// search key
	pmf->SaveSearchKey();
	//
	WriteProfileInt("Settings", "DefaultCharSet", pmf->m_nDefaultCharSet);
	//
	WriteProfileInt("Settings", "DirectOpenFile", pmf->m_bDirectOpenFile);
	WriteProfileInt("Settings", "OpenInNew", pmf->m_bOpenInNew);
	//
	WriteProfileInt("Settings", "DisableBackground", pmf->m_bDisableBackground);
	//
	WriteProfileInt("Search", "SearchMatchCase", pmf->m_bSearchMatchCase);
	WriteProfileInt("Search", "SearchMatchWhole", pmf->m_bSearchMatchWhole);
	WriteProfileInt("Search", "NotSaveKeyword", pmf->m_bNotSaveKeyword);
	//
	WriteProfileInt("Settings", "PageMax", g_bMax);
	WriteProfileInt("Settings", "AutoRunExternal", pmf->m_bAutoRunExternal);

	//must place here, for that this can be changed in status bar
	WriteProfileInt("Mouse", "RMouseDrag", pmf->m_bRMouseDrag );
	WriteProfileInt("Mouse", "RMouseGesture", pmf->m_bRMouseGesture );

	}catch(...){}
}

BOOL CMyIEApp::OnIdle(LONG lCount) 
{
	// TODO: Add your specialized code here and/or call the base class
	try{
	if(pmf!=NULL)
	{
		if( pmf->m_bFavDirty && m_nDelay>30 )
		{
			pmf->PostMessage(WM_UPDATE_FAV,pmf->m_bFavDirty,0);
			pmf->m_bFavDirty = FALSE;
			m_nDelay=0;
		}
		else if(pmf->m_bFavDirty)
			m_nDelay++;
		//auto start
		if(m_bAutoStart)
		{
			static nAutoStartCount=0;
			int max = pmf->m_ExternalUtilList.m_UtilList.GetUpperBound();
			if(nAutoStartCount <= max)
			{
				while(nAutoStartCount <= max && pmf->m_ExternalUtilList.m_UtilList.GetAt(nAutoStartCount)->m_bUtilStart==FALSE)
				{
					nAutoStartCount++;
				}
				if(nAutoStartCount <= max)
				{
					//start the tool
					pmf->StartUtil(nAutoStartCount);
					nAutoStartCount++;
				}
				else
					m_bAutoStart = FALSE;
			}
			else
				m_bAutoStart = FALSE;
		}
		if(pmf->m_bSaveConfig)
		{
			pmf->m_bSaveConfig = FALSE;
			AfxBeginThread(TSaveConfig, NULL);
		}
	}
	//
	if (lCount <= 0)
	{
		ThreadOnIdle(lCount);
	}
	else if (lCount == 1)
	{
		ThreadOnIdle(lCount);
	}
	return lCount < 1;  // more to do if lCount < 1

	}
	catch(...)
	{
		return lCount < 1;
	}
}

BOOL CMyIEApp::ThreadOnIdle(LONG lCount)
{
	ASSERT_VALID(this);

	try{
	if (lCount <= 0)
	{
	}
	else if (lCount >= 0)
	{
		AFX_MODULE_THREAD_STATE* pState = _AFX_CMDTARGET_GETSTATE()->m_thread;
		if (pState->m_nTempMapLock == 0)
		{
			// free temp maps, OLE DLLs, etc.
			AfxLockTempMaps();
			AfxUnlockTempMaps();
		}
	}
	}catch(...){}

	return lCount < 0;  // nothing more to do if lCount >= 0
}

//#######################################################################################
CMyIEModule _Module;

BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_MyIENSHandle, CMyIENSHandle)
END_OBJECT_MAP()

LONG CMyIEModule::Unlock()
{
	AfxOleUnlockApp();
	return 0;
}

LONG CMyIEModule::Lock()
{
	AfxOleLockApp();
	return 1;
}
LPCTSTR CMyIEModule::FindOneOf(LPCTSTR p1, LPCTSTR p2)
{
	while (*p1 != NULL)
	{
		LPCTSTR p = p2;
		while (*p != NULL)
		{
			if (*p1 == *p)
				return CharNext(p1);
			p = CharNext(p);
		}
		p1++;
	}
	return NULL;
}

BOOL CMyIEApp::InitATL()
{
	m_bATLInited = TRUE;
	_Module.Init(ObjectMap, AfxGetInstanceHandle());
	_Module.dwThreadID = GetCurrentThreadId();

	LPTSTR lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT
	TCHAR szTokens[] = _T("-/");

	BOOL bRun = TRUE;
	LPCTSTR lpszToken = _Module.FindOneOf(lpCmdLine, szTokens);
	while (lpszToken != NULL)
	{
		if (lstrcmpi(lpszToken, _T("UnregServer"))==0)
		{
			_Module.UpdateRegistryFromResource(IDR_MyIE, FALSE);
			_Module.UnregisterServer(TRUE); //TRUE means typelib is unreg'd
			bRun = FALSE;
			break;
		}
		if (lstrcmpi(lpszToken, _T("RegServer"))==0)
		{
			_Module.UpdateRegistryFromResource(IDR_MyIE, TRUE);
			_Module.RegisterServer(TRUE);
			bRun = FALSE;
			break;
		}
		lpszToken = _Module.FindOneOf(lpszToken, szTokens);
	}

	if (!bRun)
	{
		m_bATLInited = FALSE;
		_Module.Term();
		return FALSE;
	}

	HRESULT hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, 
		REGCLS_MULTIPLEUSE);
	if (FAILED(hRes))
	{
		m_bATLInited = FALSE;
		return FALSE;
	}	

	return TRUE;
}

BOOL CMyIEApp::IsDonated()
{
	CString strKey = GetProfileString("Register", "YourName", NULL);
	if (strKey.GetLength())
		return TRUE;
	else
		return FALSE;
}

//#pragma optimize( "s", on )

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
	ON_BN_CLICKED(IDC_DONATE, OnDonate)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BOOL CAboutDlg::OnInitDialog()
{
	LOADDLG("DialogAbout");
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CWnd *p;
	CString strAbout;
	CFile f;
	CString filename = theApp.m_strRoot + "thanks.txt";
	if(f.Open(filename, CFile::modeRead|CFile::shareDenyNone))
	{
		DWORD len = f.GetLength();
		char* tmp = new char[len+1];
		f.Read(tmp, len);
		tmp[len]='\0';
		strAbout = tmp;
		delete[] tmp;
		f.Close();
	}	
	p= GetDlgItem(IDC_THANKS);
	p->SetWindowText(strAbout);
	//
	if (theApp.IsDonated())
	{
		LOADSTR(strAbout ,IDS_DONATED);
		CString strName;
		strName = theApp.GetProfileString("Register", "YourName", NULL);
		strAbout += strName;
		//
		p= GetDlgItem(IDC_DONATE);
		p->ShowWindow(SW_HIDE);
	}
	else
	{
		LOADSTR(strAbout ,IDS_UNDONATED);
	}
	p= GetDlgItem(IDC_INFO);
	p->SetWindowText(strAbout);

	if (theApp.m_bUseLngFile)
	{
		p= GetDlgItem(IDC_ABOUT);
		p->GetWindowText(strAbout);
		p->SetWindowText(strAbout);
	}
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CAboutDlg::OnDonate() 
{
	// TODO: Add your control notification handler code here
	int ret = MSGBOX(IDS_STR_DONATE, MB_YESNOCANCEL|MB_ICONQUESTION);
	if(ret==IDYES)
	{
		pmf->NewChildWindow(1,2,"http://www.regsoft.net/purchase.php3?productid=58390");
		CDialog::OnOK();
	}
	else if(ret== IDNO)
	{
		CInputDlg dlg;
		CString strMsg;
		LOADSTR(strMsg ,IDS_YOUR_NAME);
		dlg.m_strMsg = strMsg;
		if(dlg.DoModal() == IDOK && dlg.m_strOutput.GetLength())
		{
			theApp.WriteProfileString("Register", "YourName", dlg.m_strOutput);
			//
			CWnd *p;
			LOADSTR(strMsg ,IDS_DONATED);
			strMsg += dlg.m_strOutput;
			p= GetDlgItem(IDC_INFO);
			p->SetWindowText(strMsg);
			//
			p= GetDlgItem(IDC_DONATE);
			p->ShowWindow(SW_HIDE);
			//
			MSGBOX(IDS_THANK_DONATE);
		}
	}
}

⌨️ 快捷键说明

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