📄 myie.cpp
字号:
//the start favorite folder
((CMainFrame*)m_pMainWnd)->m_strStartFavFolder = GetProfileString("Settings", "StartFolder", NULL);
//insert to next tab
((CMainFrame*)m_pMainWnd)->m_bNextTab = GetProfileInt("Settings", "NextTab", 0);
//get my document folder
TCHAR szPath[MAX_PATH];
r = TRUE;
try
{
LPITEMIDLIST pidlMyDoc = NULL;
// Get a pointer to the IMalloc interface
IMalloc * m_pMalloc = NULL;
HRESULT hr = SHGetMalloc(&m_pMalloc);
if (SUCCEEDED(hr))
{
HRESULT hr = SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &pidlMyDoc);
if (NOERROR != hr)
r = FALSE;
else
{
r = SHGetPathFromIDList( pidlMyDoc,szPath);
}
m_pMalloc->Free(pidlMyDoc);
m_pMalloc->Release();
m_pMalloc = NULL;
}
}catch(...)
{
}
//default path
m_strDefaultDir = GetProfileString("Settings", "DefaultDir");
if(!m_strDefaultDir.IsEmpty() && m_strDefaultDir != "")
{
SetCurrentDirectory(m_strDefaultDir);
//set save directory
HKEY hKey;
if(RegOpenKey(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Internet Explorer\\Main"), &hKey) == ERROR_SUCCESS)
{
RegSetValueEx(hKey, _T("Save Directory"), 0, REG_SZ, (LPBYTE)(m_strDefaultDir.GetBuffer(10)), m_strDefaultDir.GetLength());
m_strDefaultDir.ReleaseBuffer();
}
}
else
{
if(r)
m_strDefaultDir = szPath;
}
if(m_strDefaultDir.Right(1) != "\\")
m_strDefaultDir += "\\";
//auto save
((CMainFrame*)m_pMainWnd)->m_nAutoSave = GetProfileInt("Settings", "AutoSave", 0);
((CMainFrame*)m_pMainWnd)->m_bCateWithSite = GetProfileInt("Settings", "CateWithSite", 0);
//image path
CString simage = GetProfileString("Settings", "ImagePath");
if(simage.IsEmpty())
{
//create new
//CreateDirectory(m_strImagePath, NULL);
if(r)
{
m_strImagePath = szPath;
m_strImagePath += "\\My Pictures\\";
}
m_bNeedCreateDir = TRUE;
}
else
m_strImagePath = simage;
//Exp width
((CMainFrame*)m_pMainWnd)->m_nExpWidth = GetProfileInt("Settings", "ExpWidth", 200);
//Exp Bar
CString str = GetProfileString("Settings", "ExpBar");
CString str1;
str1.LoadString(IDS_TITLE_SEARCH);
if(str==str1)
PostMessage(m_pMainWnd->m_hWnd, WM_COMMAND, ID_VIEW_EXPLOREBAR_SEARCH,0);
str1.LoadString(IDS_TITLE_HIS);
if(str==str1)
PostMessage(m_pMainWnd->m_hWnd, WM_COMMAND, ID_VIEW_HIS,0);
str1.LoadString(IDS_TITLE_FAVORITE);
if(str==str1)
PostMessage(m_pMainWnd->m_hWnd, WM_COMMAND, ID_FAVORITES_DROPDOWN,0);
str1.LoadString(IDS_TITLE_SHELL);
if(str==str1)
PostMessage(m_pMainWnd->m_hWnd, WM_COMMAND, ID_VIEW_FOLDER,0);
str1.LoadString(IDS_TITLE_RESOURCE);
if(str==str1)
PostMessage(m_pMainWnd->m_hWnd, WM_COMMAND, ID_VIEW_EXPLOREBAR_RESOURCE,0);
//autosizing tab
((CMainFrame*)m_pMainWnd)->m_bAutoTab = GetProfileInt("Settings", "AutoTab", 1);
//max autosizing tab width
((CMainFrame*)m_pMainWnd)->m_nMaxTabWidth = GetProfileInt("Settings", "MaxTabWidth", 72);
//min autosizing tab width
((CMainFrame*)m_pMainWnd)->m_nMinTabWidth = GetProfileInt("Settings", "MinTabWidth", 2);
//confirm when exit
bConfirmExit = GetProfileInt("Settings", "ConfirmExit", TRUE);
//use shortcuts
((CMainFrame*)m_pMainWnd)->m_bUseSC = GetProfileInt("Settings", "UseSC", FALSE);
//use alias
((CMainFrame*)m_pMainWnd)->m_bUseAlias = GetProfileInt("Settings", "UseAlias", TRUE);
//load shortcuts
char key[9] = "F";
for(int i=0; i<11; i++)
{
itoa(i+2, key+1, 10);
((CMainFrame*)m_pMainWnd)->m_strShortCuts[i] = GetProfileString("Shortcuts", key);
}
//Domains
((CMainFrame*)m_pMainWnd)->m_strCE1 = GetProfileString("Domains", "CE1", "http://www.");
((CMainFrame*)m_pMainWnd)->m_strCE2 = GetProfileString("Domains", "CE2", ".com");
((CMainFrame*)m_pMainWnd)->m_strSE1 = GetProfileString("Domains", "SE1", "http://www.");
((CMainFrame*)m_pMainWnd)->m_strSE2 = GetProfileString("Domains", "SE2", ".net");
((CMainFrame*)m_pMainWnd)->m_strCSE1 = GetProfileString("Domains", "CSE1", "http://www.");
((CMainFrame*)m_pMainWnd)->m_strCSE2 = GetProfileString("Domains", "CSE2", ".com.cn");
//small to tray
bSysTray = GetProfileInt("Settings", "SysTray", FALSE);
//3721
((CMainFrame*)m_pMainWnd)->m_bUse3721 = GetProfileInt("Settings", "Use3721", TRUE);
//sequence
((CMainFrame*)m_pMainWnd)->m_nSeq = GetProfileInt("Settings", "Sequence", 1);
//silent
bSilent = GetProfileInt("Settings", "Silent", TRUE);
//default font size
nDefFontSize = GetProfileInt("Settings", "DefFontSize", 2);
//disable scroll text on status bar
bURLOnly = GetProfileInt("Settings", "DisScrollText", FALSE);
//filte blank popup window from same parent
bFilteBlank = GetProfileInt("Settings", "FilteBlank", FALSE);
//interval
((CMainFrame*)m_pMainWnd)->m_nInterval = GetProfileInt("Settings", "Interval", 0);
//open link in new window
// bLinkInNewWin = GetProfileInt("Settings", "LinkInNewWin", 0);
//browser mode
((CMainFrame*)m_pMainWnd)->m_bmStandard.m_bActiveNewWindow = TRUE;
((CMainFrame*)m_pMainWnd)->m_bmStandard.m_bAlwaysNewWindow = FALSE;
((CMainFrame*)m_pMainWnd)->m_bmStandard.m_nSeq = 1;
((CMainFrame*)m_pMainWnd)->m_bmStandard.bLinkInNewWin = FALSE;
((CMainFrame*)m_pMainWnd)->m_bmNews.m_bActiveNewWindow = FALSE;
((CMainFrame*)m_pMainWnd)->m_bmNews.m_bAlwaysNewWindow = TRUE;
((CMainFrame*)m_pMainWnd)->m_bmNews.m_nSeq = 1;
((CMainFrame*)m_pMainWnd)->m_bmNews.bLinkInNewWin = TRUE;
((CMainFrame*)m_pMainWnd)->m_bmUserDefault.m_bActiveNewWindow = GetProfileInt("BModes", "ActiveNewWindow", ((CMainFrame*)m_pMainWnd)->m_bActiveNewWindow);
((CMainFrame*)m_pMainWnd)->m_bmUserDefault.m_bAlwaysNewWindow = GetProfileInt("BModes", "AlwaysNewWindow", bAddressInNewWindow);
((CMainFrame*)m_pMainWnd)->m_bmUserDefault.m_nSeq = GetProfileInt("BModes", "Seq", ((CMainFrame*)m_pMainWnd)->m_nSeq);
((CMainFrame*)m_pMainWnd)->m_bmUserDefault.bLinkInNewWin = GetProfileInt("BModes", "LinkInNewWin", bLinkInNewWindow);
//auto scroll
((CMainFrame*)m_pMainWnd)->m_bDefScrollAfterDL = GetProfileInt("Settings", "AutoScrollAfterDL", TRUE);
((CMainFrame*)m_pMainWnd)->m_bDefUseAutoScroll = GetProfileInt("Settings", "UseAutoScroll", FALSE);
((CMainFrame*)m_pMainWnd)->m_nDefSrSpeed = GetProfileInt("Settings", "SrSpeed", 1);
//scroll speed
gSeed = (float)GetProfileInt("Settings", "SpeedSeed", 100);
if(gSeed == 0)
gSeed = 1;
else
gSeed = gSeed/100;
bConfirmCloseAll = GetProfileInt("Settings", "ConfirmCloseAll", TRUE);
//start group
((CMainFrame*)m_pMainWnd)->m_strStartGroup = GetProfileString("Settings", "StartGroup", "");
//new window
((CMainFrame*)m_pMainWnd)->m_nNewWindow = GetProfileInt("Settings", "NewWindow", 0);
//allow double click to close window
((CMainFrame*)m_pMainWnd)->m_nAllowDBC = GetProfileInt("Settings", "AllowDBC", 1);
((CMainFrame*)m_pMainWnd)->m_nAllowMC = GetProfileInt("Settings", "AllowMC", 1);
//default bg color
((CMainFrame*)m_pMainWnd)->m_strBGColor = GetProfileString("Settings", "BGColor", "#FFFFFF");
//default auto refresh
((CMainFrame*)m_pMainWnd)->m_nDefRefreshInterval = GetProfileInt("Settings", "AutoRefresh", 60);
//security
((CMainFrame*)m_pMainWnd)->m_bSecure = GetProfileInt("Settings", "Secure", FALSE);
//auto set background
bAutoSetBG = GetProfileInt("Settings", "AutoSetBG", FALSE);
//animate icon
((CMainFrame*)m_pMainWnd)->m_bAnimatIcon = AfxGetApp()->GetProfileInt("Settings", "AnimateIcon", TRUE);
//mouse gestures
((CMainFrame*)m_pMainWnd)->m_bAllowMouseGestures = AfxGetApp()->GetProfileInt("Settings", "MouseGestures", TRUE);
//lock homepage
bLockHomepage = AfxGetApp()->GetProfileInt("Settings", "LockHomepage", FALSE);
//delay load
((CMainFrame*)m_pMainWnd)->PostMessage(WM_DELAYLOAD_CONFIG);
}
void CMyIEApp::SaveConfg()
{
//save popup list
// CString allpopups;
/*
POSITION pos = ((CMainFrame*)m_pMainWnd)->m_astrPopup.GetHeadPosition();
UINT i=0;
while(pos!=NULL)
{
allpopups += ((CMainFrame*)m_pMainWnd)->m_astrPopup.GetAt(pos);
allpopups += "\n";
((CMainFrame*)m_pMainWnd)->m_astrPopup.GetNext(pos);
}
WriteProfileBinary("Settings","Popups", (LPBYTE)allpopups.GetBuffer(1), allpopups.GetLength()+1);
*/
try{
UINT i = 1;
WriteProfileString("Popups", NULL, "");
char Keyname[12] = "popup";
POSITION pos = ((CMainFrame*)m_pMainWnd)->m_astrPopup.GetHeadPosition();
while(pos!=NULL)
{
itoa(i, Keyname+5, 10);
WriteProfileString("Popups", Keyname, ((CMainFrame*)m_pMainWnd)->m_astrPopup.GetAt(pos));
((CMainFrame*)m_pMainWnd)->m_astrPopup.GetNext(pos);
i++;
}
WriteProfileInt("Settings", "EnablePop", EnablePopupFilter);
WriteProfileInt("Settings", "EnableDupFilter", EnableDupFilter);
WriteProfileInt("Settings", "EnableAutoFilter", EnableAutoFilter);
WriteProfileInt("Settings", "goHome", bGoHome);
WriteProfileInt("Settings", "TabSize", ((CMainFrame*)m_pMainWnd)->m_nTitleLen);
BYTE *tmp = NULL;
// int cn;
//=======================================Proxy=========================================
((CMainFrame*)m_pMainWnd)->m_aProxyCategories.SaveProxies();
//save web proxies
/* allpopups.Empty();
pos = ((CMainFrame*)m_pMainWnd)->m_astrWebProxy.GetHeadPosition();
i=0;
while(pos!=NULL)
{
allpopups += ((CMainFrame*)m_pMainWnd)->m_astrWebProxy.GetAt(pos);
allpopups += "\n";
((CMainFrame*)m_pMainWnd)->m_astrWebProxy.GetNext(pos);
}
WriteProfileBinary("Settings","WebProxy", (LPBYTE)allpopups.GetBuffer(1), allpopups.GetLength()+1);
//save webproxy speed
pos = ((CMainFrame*)m_pMainWnd)->m_aWebProxySpeed.GetHeadPosition();
i=0;
int cn = ((CMainFrame*)m_pMainWnd)->m_aWebProxySpeed.GetCount();
if(cn>0)
tmp = new BYTE[cn];
while(pos!=NULL)
{
tmp[i] = ((CMainFrame*)m_pMainWnd)->m_aWebProxySpeed.GetAt(pos);
((CMainFrame*)m_pMainWnd)->m_aWebProxySpeed.GetNext(pos);
i++;
}
WriteProfileBinary("Settings","WebProxySP", tmp, cn);
if(tmp!=NULL)
delete tmp;
*/
i = 1;
char Keyname1[10]="wp", Keyname2[11]="wps", Keyname3[11]="wpn", Keyname4[11];
/* WriteProfileString("WebProxy", NULL, "");
pos = ((CMainFrame*)m_pMainWnd)->m_astrWebProxy.GetHeadPosition();
while(pos!=NULL)
{
itoa(i, Keyname1+2, 10);
WriteProfileString("WebProxy", Keyname1, ((CMainFrame*)m_pMainWnd)->m_astrWebProxy.GetAt(pos));
((CMainFrame*)m_pMainWnd)->m_astrWebProxy.GetNext(pos);
i++;
}
i = 1;
pos = ((CMainFrame*)m_pMainWnd)->m_aWebProxySpeed.GetHeadPosition();
while(pos!=NULL)
{
itoa(i, Keyname2+3, 10);
WriteProfileInt("WebProxy", Keyname2, ((CMainFrame*)m_pMainWnd)->m_aWebProxySpeed.GetAt(pos));
((CMainFrame*)m_pMainWnd)->m_aWebProxySpeed.GetNext(pos);
i++;
}
i = 1;
pos = ((CMainFrame*)m_pMainWnd)->m_astrWebProxyName.GetHeadPosition();
while(pos!=NULL)
{
itoa(i, Keyname3+3, 10);
WriteProfileString("WebProxy", Keyname3, ((CMainFrame*)m_pMainWnd)->m_astrWebProxyName.GetAt(pos));
((CMainFrame*)m_pMainWnd)->m_astrWebProxyName.GetNext(pos);
i++;
}*/
//save defaul web proxy
WriteProfileString("Settings","DefaultWebProxy", ((CMainFrame*)m_pMainWnd)->m_strDefaultWebProxy);
//save by pass
WriteProfileString("Settings","ProxyByPass", ((CMainFrame*)m_pMainWnd)->m_strProxyByPass);
//save proxy list
WriteProfileInt("Settings","ProxyList", ((CMainFrame*)m_pMainWnd)->m_nCurProxyList);
//get current setting
/*2.0
CString strCurProxy, bypass, user, pwd;
if(((CMainFrame*)m_pMainWnd)->GetProxySetting(strCurProxy, bypass, user, pwd))
{ //save the curproxy
if(!((CMainFrame*)m_pMainWnd)->m_astrProxy.Find(strCurProxy))
{
((CMainFrame*)m_pMainWnd)->m_astrProxy.AddHead(strCurProxy);
((CMainFrame*)m_pMainWnd)->m_aProxySpeed.AddHead(3);
// ((CMainFrame*)m_pMainWnd)->m_astrProxyUser.AddHead(user);
// ((CMainFrame*)m_pMainWnd)->m_astrProxyPwd.AddHead(pwd);
}
}
*/
//save proxy servers
/* allpopups.Empty();
pos = ((CMainFrame*)m_pMainWnd)->m_astrProxy.GetHeadPosition();
i=0;
while(pos!=NULL)
{
allpopups += ((CMainFrame*)m_pMainWnd)->m_astrProxy.GetAt(pos);
allpopups += "\n";
((CMainFrame*)m_pMainWnd)->m_astrProxy.GetNext(pos);
}
WriteProfileBinary("Settings","Proxy", (LPBYTE)allpopups.GetBuffer(1), allpopups.GetLength()+1);
*/
//save proxy users
/* allpopups.Empty();
pos = ((CMainFrame*)m_pMainWnd)->m_astrProxyUser.GetHeadPosition();
i=0;
while(pos!=NULL)
{
allpopups += ((CMainFrame*)m_pMainWnd)->m_astrProxyUser.GetAt(pos);
allpopups += "\n";
((CMainFrame*)m_pMainWnd)->m_astrProxyUser.GetNext(pos);
}
WriteProfileBinary("Settings","ProxyUser", (LPBYTE)allpopups.GetBuffer(1), allpopups.GetLength()+1);
//save proxy servers password
allpopups.Empty();
pos = ((CMainFrame*)m_pMainWnd)->m_astrProxyPwd.GetHeadPosition();
i=0;
while(pos!=NULL)
{
allpopups += ((CMainFrame*)m_pMainWnd)->m_astrProxyPwd.GetAt(pos);
allpopups += "\n";
((CMainFrame*)m_pMainWnd)->m_astrProxyPwd.GetNext(pos);
}
WriteProfileBinary("Settings","ProxyPwd", (LPBYTE)allpopups.GetBuffer(1), allpopups.GetLength()+1);
*/
//save proxy speed
/* tmp = NULL;
pos = ((CMainFrame*)m_pMainWnd)->m_aProxySpeed.GetHeadPosition();
i=0;
cn = ((CMainFrame*)m_pMainWnd)->m_aProxySpeed.GetCount();
if(cn>0)
tmp = new BYTE[cn];
while(pos!=NULL)
{
tmp[i] = ((CMainFrame*)m_pMainWnd)->m_aProxySpeed.GetAt(pos);
((CMainFrame*)m_pMainWnd)->m_aProxySpeed.GetNext(pos);
i++;
}
WriteProfileBinary("Settings","ProxySP", tmp, cn);
if(tmp!=NULL)
delete tmp;
*/
/*2.3 i = 1;
WriteProfileString("Proxy", NULL, "");
Keyname1[0]='p'; Keyname2[0]='p'; Keyname2[1]='s'; Keyname3[0]='p'; Keyname3[1]='n';
pos = ((CMainFrame*)m_pMainWnd)->m_astrProxy.GetHeadPosition();
while(pos!=NULL)
{
itoa(i, Keyname1+1, 10);
WriteProfileString("Proxy", Keyname1, ((CMainFrame*)m_pMainWnd)->m_astrProxy.GetAt(pos));
((CMainFrame*)m_pMainWnd)->m_astrProxy.GetNext(pos);
i++;
}
i = 1;
pos = ((CMainFrame*)m_pMainWnd)->m_aProxySpeed.GetHeadPosition();
while(pos!=NULL)
{
itoa(i, Keyname2+2, 10);
WriteProfileInt("Proxy", Keyname2, ((CMainFrame*)m_pMainWnd)->m_aProxySpeed.GetAt(pos));
((CMainFrame*)m_pMainWnd)->m_aProxySpeed.GetNext(pos);
i++;
}
i = 1;
pos = ((CMainFrame*)m_pMainWnd)->m_astrProxyName.GetHeadPosition();
while(pos!=NULL)
{
itoa(i, Keyname3+2, 10);
WriteProfileString("Proxy", Keyname3, ((CMainFrame*)m_pMainWnd)->m_astrProxyName.GetAt(pos));
((CMainFrame*)m_pMainWnd)->m_astrProxyName.GetNext(pos);
i++;
}
*/
//save defaul proxy
WriteProfileString("Settings","DefaultProxy", ((CMainFrame*)m_pMainWnd)->m_strCurProxy);
//tab pos
WriteProfileInt("Settings", "TabPos", m_bTopTab);
//save utils names
/* allpopups.Empty();
pos = ((CMainFrame*)m_pMainWnd)->m_lstrUtilNames.GetHeadPosition();
i=0;
while(pos!=NULL)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -