📄 myie.cpp
字号:
}
void CMyIEApp::LoadConfg()
{
//get pop list
UINT len;
char *tmp = NULL;
BOOL r;
CString pop = GetProfileString("Popups", "popup1", NULL);
if(pop == "" || pop.IsEmpty())
{
r = GetProfileBinary("Settings","Popups", (LPBYTE*)(&tmp), &len);
if(r)
{
//load pop list
char *token;
char seps[] = "\n";
token = strtok( tmp, seps);
while( token != NULL )
{
/* While there are tokens in "string" */
((CMainFrame*)m_pMainWnd)->m_astrPopup.AddTail(token);
/* Get next token: */
token = strtok( NULL, seps );
}
delete[] tmp;
}
}
else
{
//load new one
char Keyname[12] = "popup";
int i=1;
while(pop != "" && !pop.IsEmpty())
{
((CMainFrame*)m_pMainWnd)->m_astrPopup.AddTail(pop);
i++;
itoa(i, Keyname+5, 10);
pop = GetProfileString("Popups", Keyname, NULL);
}
}
//enable popup
EnablePopupFilter = GetProfileInt("Settings", "EnablePop", 1);
if(EnablePopupFilter)
((CMainFrame*)m_pMainWnd)->GetMenu()->CheckMenuItem(ID_TOOLS_EABLEPOPUPFILTER,MF_CHECKED);
else
((CMainFrame*)m_pMainWnd)->GetMenu()->CheckMenuItem(ID_TOOLS_EABLEPOPUPFILTER,MF_UNCHECKED);
//window pos
int top = GetProfileInt("Settings", "top", 100);
int left = GetProfileInt("Settings", "left", 100);
int width = GetProfileInt("Settings", "width", 500);
int height = GetProfileInt("Settings", "height", 400);
if( width!=0 && top<1000)
m_pMainWnd->SetWindowPos(&CWnd::wndTop, left, top, width, height,SWP_HIDEWINDOW);
if( GetProfileInt("Settings", "Zoomed", 0))
m_nCmdShow = SW_SHOWMAXIMIZED;
((CMainFrame*)m_pMainWnd)->m_nTitleLen = GetProfileInt("Settings", "TabSize", 11);
//load web proxies
//load new format first
CString wp = GetProfileString("WebProxy", "wp1", NULL);
if(wp == "" || wp.IsEmpty())
{
//then load old one
tmp = NULL;
r = GetProfileBinary("Settings","WebProxy", (LPBYTE*)(&tmp), &len);
if(r)
{
//load pop list
char *token;
char seps[] = "\n";
token = strtok( tmp, seps);
while( token != NULL )
{
/* While there are tokens in "string" */
((CMainFrame*)m_pMainWnd)->m_astrWebProxy.AddTail(token);
/* Get next token: */
token = strtok( NULL, seps );
}
delete[] tmp;
}
//load webproxy speed
tmp = NULL;
r = GetProfileBinary("Settings","WebProxySP", (LPBYTE*)(&tmp), &len);
if(r)
{
//load pop list
for( int i=0;i<len;i++ )
{
((CMainFrame*)m_pMainWnd)->m_aWebProxySpeed.AddTail(tmp[i]);
}
delete[] tmp;
}
}
else
{
//load new one
char Keyname1[6] = "wp", Keyname2[7] = "wps";
int sp, i=1;
sp = GetProfileInt("WebProxy", "wps1", 3);
while(wp != "" && !wp.IsEmpty())
{
((CMainFrame*)m_pMainWnd)->m_astrWebProxy.AddTail(wp);
((CMainFrame*)m_pMainWnd)->m_aWebProxySpeed.AddTail(sp);
i++;
itoa(i, Keyname1+2, 10);
itoa(i, Keyname2+3, 10);
wp = GetProfileString("WebProxy", Keyname1, NULL);
sp = GetProfileInt("WebProxy", Keyname2, 3);
}
}
//load defaul web proxy
((CMainFrame*)m_pMainWnd)->m_strDefaultWebProxy = GetProfileString("Settings", "DefaultWebProxy", NULL);
if(((CMainFrame*)m_pMainWnd)->m_strDefaultWebProxy.IsEmpty())
{
((CMainFrame*)m_pMainWnd)->m_strDefaultWebProxy.LoadString(IDS_DEFAULT_WEB_PROXY);
((CMainFrame*)m_pMainWnd)->m_astrWebProxy.AddTail(((CMainFrame*)m_pMainWnd)->m_strDefaultWebProxy);
((CMainFrame*)m_pMainWnd)->m_aWebProxySpeed.AddTail(3);
}
//load proxy servers
wp = GetProfileString("Proxy", "p1", NULL);
if(wp == "" || wp.IsEmpty())
{
tmp = NULL;
r = GetProfileBinary("Settings","Proxy", (LPBYTE*)(&tmp), &len);
if(r)
{
//load pop list
char *token;
char seps[] = "\n";
token = strtok( tmp, seps);
while( token != NULL )
{
/* While there are tokens in "string" */
((CMainFrame*)m_pMainWnd)->m_astrProxy.AddTail(token);
/* Get next token: */
token = strtok( NULL, seps );
}
delete[] tmp;
}
// int pn = ((CMainFrame*)m_pMainWnd)->m_astrProxy.GetCount();
//load proxy user name
/* tmp = NULL;
r = GetProfileBinary("Settings","ProxyUser", (LPBYTE*)(&tmp), &len);
if(r)
{
//load pop list
char *token;
char seps[] = "\n";
token = strtok( tmp, seps);
while( token != NULL )
{
// While there are tokens in "string"
((CMainFrame*)m_pMainWnd)->m_astrProxyUser.AddTail(token);
// Get next token:
token = strtok( NULL, seps );
}
delete[] tmp;
}
//load proxy password
tmp = NULL;
r = GetProfileBinary("Settings","ProxyPwd", (LPBYTE*)(&tmp), &len);
if(r)
{
//load pop list
char *token;
char seps[] = "\n";
token = strtok( tmp, seps);
while( token != NULL )
{
// While there are tokens in "string"
((CMainFrame*)m_pMainWnd)->m_astrProxyPwd.AddTail(token);
// Get next token:
token = strtok( NULL, seps );
}
delete[] tmp;
}
*/
//load proxy speed
tmp = NULL;
r = GetProfileBinary("Settings","ProxySP", (LPBYTE*)(&tmp), &len);
if(r)
{
//load pop list
for( int i=0;i<len;i++ )
{
((CMainFrame*)m_pMainWnd)->m_aProxySpeed.AddTail(tmp[i]);
}
delete[] tmp;
}
}
else
{
//new format
char Keyname1[6] = "p", Keyname2[7] = "ps";
int sp, i=1;
sp = GetProfileInt("Proxy", "ps1", 3);
while(wp != "" && !wp.IsEmpty())
{
((CMainFrame*)m_pMainWnd)->m_astrProxy.AddTail(wp);
((CMainFrame*)m_pMainWnd)->m_aProxySpeed.AddTail(sp);
i++;
itoa(i, Keyname1+1, 10);
itoa(i, Keyname2+2, 10);
wp = GetProfileString("Proxy", Keyname1, NULL);
sp = GetProfileInt("Proxy", Keyname2, 3);
}
}
//adjust number of proxy list
/* if(pn!=((CMainFrame*)m_pMainWnd)->m_astrProxyUser.GetCount())
{
((CMainFrame*)m_pMainWnd)->m_astrProxyUser.RemoveAll();
for(int i=0; i<pn;i++)
((CMainFrame*)m_pMainWnd)->m_astrProxyUser.AddHead("");
}
if(pn!=((CMainFrame*)m_pMainWnd)->m_astrProxyPwd.GetCount())
{
((CMainFrame*)m_pMainWnd)->m_astrProxyPwd.RemoveAll();
for(int i=0; i<pn;i++)
((CMainFrame*)m_pMainWnd)->m_astrProxyPwd.AddHead("");
}*/
/*v2.0 delete
if(pn>((CMainFrame*)m_pMainWnd)->m_aProxySpeed.GetCount())
{
((CMainFrame*)m_pMainWnd)->m_aProxySpeed.RemoveAll();
for(int i=0; i<pn;i++)
((CMainFrame*)m_pMainWnd)->m_aProxySpeed.AddHead(3);
}
pn=((CMainFrame*)m_pMainWnd)->m_astrWebProxy.GetCount();
if(pn>((CMainFrame*)m_pMainWnd)->m_aWebProxySpeed.GetCount())
{
((CMainFrame*)m_pMainWnd)->m_aWebProxySpeed.RemoveAll();
for(int i=0; i<pn;i++)
((CMainFrame*)m_pMainWnd)->m_aWebProxySpeed.AddHead(3);
}
*/
//load defaul proxy
((CMainFrame*)m_pMainWnd)->m_strCurProxy = GetProfileString("Settings", "DefaultProxy", NULL);
((CMainFrame*)m_pMainWnd)->m_strProxyByPass = ((CMainFrame*)m_pMainWnd)->m_strCurProxy+" <local>";
//active new window
((CMainFrame*)m_pMainWnd)->m_bActiveNewWindow = GetProfileInt("Settings", "ActiveNew", 1);
//always new window
((CMainFrame*)m_pMainWnd)->m_bAlwaysNewWindow = GetProfileInt("Settings", "AlwaysNew", 0);
//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);
//display ip
((CMainFrame*)m_pMainWnd)->m_bDisplayIP = GetProfileInt("Settings", "DisplayIP", 0);
//default path
m_strDefaultDir = GetProfileString("Settings", "DefaultDir");
if(!m_strDefaultDir.IsEmpty() && m_strDefaultDir != "")
SetCurrentDirectory(m_strDefaultDir);
//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", 0);
//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);
}
//load alias
i=0; //int j;
CString alias,url;
r = TRUE;
while(r)
{
key[0] = 'A';
itoa(i, key+1, 10);
alias = GetProfileString("Alias", key);
if(alias=="" || alias.IsEmpty())
r=FALSE;
else
{
key[0] = 'U';
itoa(i, key+1, 10);
url = GetProfileString("Alias", key);
if(url=="" || url.IsEmpty())
r=FALSE;
else
((CMainFrame*)m_pMainWnd)->m_mapAlias.SetAt(alias, url);
}
i++;
}
//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", FALSE);
//sequence
((CMainFrame*)m_pMainWnd)->m_nSeq = GetProfileInt("Settings", "Sequence", 1);
//silent
bSilent = GetProfileInt("Settings", "Silent", FALSE);
//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", ((CMainFrame*)m_pMainWnd)->m_bAlwaysNewWindow);
((CMainFrame*)m_pMainWnd)->m_bmUserDefault.m_nSeq = GetProfileInt("BModes", "Seq", ((CMainFrame*)m_pMainWnd)->m_nSeq);
((CMainFrame*)m_pMainWnd)->m_bmUserDefault.bLinkInNewWin = GetProfileInt("BModes", "LinkInNewWin", bLinkInNewWin);
//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 = GetProfileInt("Settings", "SpeedSeed", 100);
if(gSeed == 0)
gSeed = 1;
else
gSeed = gSeed/100;
}
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);
*/
int 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);
//window position
if(m_pMainWnd->IsZoomed())
WriteProfileInt("Settings", "Zoomed", TRUE);
else
{
WriteProfileInt("Settings", "Zoomed", FALSE);
CRect rect;
m_pMainWnd->GetWindowRect(&rect);
WriteProfileInt("Settings", "top", rect.top);
WriteProfileInt("Settings", "left", rect.left);
WriteProfileInt("Settings", "width", rect.Width());
WriteProfileInt("Settings", "Height", rect.Height());
}
WriteProfileInt("Settings", "goHome", bGoHome);
WriteProfileInt("Settings", "TabSize", ((CMainFrame*)m_pMainWnd)->m_nTitleLen);
BYTE *tmp = NULL;
int cn;
//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++;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -