📄 mainfrm.cpp
字号:
{
/* int i=(int)wParam;
HKEY nhKeyRoot=HKEY_CURRENT_USER;
LPSTR nszKeyPath="Software\\BLeo2004\\DownLoad";
LPSTR nszProgramePath="Software\\BLeo2004\\Dir";
LPSTR nszSubKeyPath="Software\\BLeo2004\\DownLoad\\Down";
CLRegistry vDownRegistry;
if(vDownRegistry.Open(nhKeyRoot,nszProgramePath))
{
int nNumber;
vDownRegistry.Read("Number",nNumber);
nNumber-=1;
vDownRegistry.Write("Number",nNumber);
}
vDownRegistry.Close();
END_CUSTHREAD stEndThread;
stEndThread.bIsEndThread=FALSE;
m_stEndThreadArray.SetAt(i,stEndThread);
CString sTemp;
sTemp="";
sTemp.Format("%s%d",nszSubKeyPath,i);
vDownRegistry.DeleteValueKey(nhKeyRoot,(LPCTSTR)sTemp);
CTestDownView *TestView=GetTestDownView();
TestView->m_ListNew.DeleteItem(i-1);*/
}
void CMainFrame::OnClose()
{
// TODO: Add your message handler code here and/or call default
CHttpDownLoad *pHttpDownLoad;
THREADNUMBER *stThreadNumber;
for(POSITION pos=m_HttpDLPtr.GetStartPosition();pos!=NULL;)
{
m_HttpDLPtr.GetNextAssoc(pos,(void*&)stThreadNumber,(void*&)pHttpDownLoad);
if(!pHttpDownLoad->m_bIsEndThe)
{
//==================
INT nPID=pHttpDownLoad->m_stLeoDownInfo.nPID;
HKEY nhKeyRoot=HKEY_CURRENT_USER;
LPSTR nszSubKeyPath="Software\\BLeo2004\\DownLoad\\Down";
CLRegistry DownRegistry;
CString sTemp;
sTemp="";
sTemp.Format("%s%d",nszSubKeyPath,nPID+1);
if(DownRegistry.Open(nhKeyRoot,(LPCTSTR)sTemp))
{
DownRegistry.Write("Image",2);
}
DownRegistry.Close();
//==================
if(pHttpDownLoad->m_bIsAfxBegin5Thread0)
{
TerminateThread(pHttpDownLoad->m_MulHand[0],0);
//CloseHandle(pHttpDownLoad->m_MulHand[0]);
}
if(pHttpDownLoad->m_bIsAfxBegin5Thread1)
{
TerminateThread(pHttpDownLoad->m_MulHand[1],0);
//CloseHandle(pHttpDownLoad->m_MulHand[1]);
}
if(pHttpDownLoad->m_bIsAfxBegin5Thread2)
{
TerminateThread(pHttpDownLoad->m_MulHand[2],0);
//CloseHandle(pHttpDownLoad->m_MulHand[2]);
}
if(pHttpDownLoad->m_bIsAfxBegin5Thread3)
{
TerminateThread(pHttpDownLoad->m_MulHand[3],0);
//CloseHandle(pHttpDownLoad->m_MulHand[3]);
}
if(pHttpDownLoad->m_bIsAfxBegin5Thread4)
{
TerminateThread(pHttpDownLoad->m_MulHand[4],0);
//CloseHandle(pHttpDownLoad->m_MulHand[4]);
}
pHttpDownLoad->SetThreadEnd(TRUE);
}
}
CFrameWnd::OnClose();
}
void CMainFrame::OnExit()
{
// TODO: Add your command handler code here
SendMessage(WM_CLOSE,0,0);
}
void CMainFrame::OnBlockAnimated()
{
// TODO: Add your command handler code here
// LPSTR nszNAnimated="BlockAnimated";
int nDest;
int nDest1=1,nDest0=0;
m_lRegistry.Read(nszNAnimated,nDest);
if(nDest==1)
{
m_lRegistry.Write(nszNAnimated,nDest0);
}
else
{
m_lRegistry.Write(nszNAnimated,nDest1);
}
}
void CMainFrame::OnUpdateBlockAnimated(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// LPSTR nszNAnimated="BlockAnimated";
int nDest;
m_lRegistry.Read(nszNAnimated,nDest);
if(nDest==1)
{
pCmdUI->SetCheck(TRUE);
}
else
{
pCmdUI->SetCheck(FALSE);
}
}
void CMainFrame::OnBlockFlash()
{
// TODO: Add your command handler code here
// LPSTR nszNFlash="BlockFlash";
int nDest;
int nDest1=1,nDest0=0;
m_lRegistry.Read(nszNFlash,nDest);
if(nDest==1)
{
m_lRegistry.Write(nszNFlash,nDest0);
m_IERegistry.Write("Display Inline Videos","yes");
}
else
{
m_lRegistry.Write(nszNFlash,nDest1);
m_IERegistry.Write("Display Inline Videos","no");
}
}
void CMainFrame::OnUpdateBlockFlash(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// LPSTR nszNFlash="BlockFlash";
int nDest;
m_lRegistry.Read(nszNFlash,nDest);
if(nDest==1)
{
pCmdUI->SetCheck(TRUE);
m_IERegistry.Write("Display Inline Videos","no");
}
else
{
pCmdUI->SetCheck(FALSE);
m_IERegistry.Write("Display Inline Videos","yes");
}
}
void CMainFrame::OnBlockPicture()
{
// TODO: Add your command handler code here
// LPSTR nszNPicture="BlockPicture";
int nDest;
int nDest1=1,nDest0=0;
m_lRegistry.Read(nszNPicture,nDest);
if(nDest==1)
{
m_lRegistry.Write(nszNPicture,nDest0);
}
else
{
m_lRegistry.Write(nszNPicture,nDest1);
}
}
void CMainFrame::OnUpdateBlockPicture(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// LPSTR nszNPicture="BlockPicture";
int nDest;
m_lRegistry.Read(nszNPicture,nDest);
if(nDest==1)
{
pCmdUI->SetCheck(TRUE);
}
else
{
pCmdUI->SetCheck(FALSE);
}
}
void CMainFrame::OnBlockPopupwin()
{
// TODO: Add your command handler code here
// LPSTR nszNPopupWin="BlockPopupWin";
int nDest;
int nDest1=1,nDest0=0;
m_lRegistry.Read(nszNPopupWin,nDest);
if(nDest==1)
m_lRegistry.Write(nszNPopupWin,nDest0);
else
m_lRegistry.Write(nszNPopupWin,nDest1);
}
void CMainFrame::OnUpdateBlockPopupwin(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// LPSTR nszNPopupWin="BlockPopupWin";
int nDest;
m_lRegistry.Read(nszNPopupWin,nDest);
if(nDest==1)
pCmdUI->SetCheck(TRUE);
else
pCmdUI->SetCheck(FALSE);
}
void CMainFrame::OnBlockUrl()
{
// TODO: Add your command handler code here
// LPSTR nszNBlockUrl="BlockUrl";
int nDest;
int nDest1=1,nDest0=0;
m_lRegistry.Read(nszNBlockUrl,nDest);
if(nDest==1)
m_lRegistry.Write(nszNBlockUrl,nDest0);
else
m_lRegistry.Write(nszNBlockUrl,nDest1);
}
void CMainFrame::OnUpdateBlockUrl(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// LPSTR nszNBlockUrl="BlockUrl";
int nDest;
m_lRegistry.Read(nszNBlockUrl,nDest);
if(nDest==1)
pCmdUI->SetCheck(TRUE);
else
pCmdUI->SetCheck(FALSE);
}
void CMainFrame::OnWwwUrl()
{
// TODO: Add your command handler code here
//输入要屏蔽的网站地址
CDlgBlockUrl m_BlockUrlDlg;
if(m_BlockUrlDlg.DoModal()==IDOK)
{
}
}
void CMainFrame::OnDlgUrlAdd(WPARAM wParam,LPARAM lParam)
{
LEO_DLGURLINFO *wUrlInfo;
wUrlInfo=(LEO_DLGURLINFO*)lParam;
CString psKey,psValue;
psKey.Format("Url%d",wUrlInfo->index);
psValue=wUrlInfo->str;
psValue.MakeLower();
m_UrlRegistry.Write((LPCTSTR)psKey,(LPCTSTR)psValue);
}
void CMainFrame::OnDlgUrlDel(WPARAM wParam,LPARAM lParam)
{
LEO_DLGURLINFO *wUrlInfo;
wUrlInfo=(LEO_DLGURLINFO*)lParam;
int nindex=wUrlInfo->index;
CString psKey;
psKey.Format("Url%d",nindex);
m_UrlRegistry.DeleteValue((LPCTSTR)psKey);
}
void CMainFrame::OnDlgUrlDelAll(WPARAM wParam,LPARAM lParam)
{
HKEY nhKeyRoot=HKEY_CURRENT_USER;
LPSTR nszS1KeyPath="Software\\BLeo2004\\BlockUrl";
//删除BlockUrl子键
if(wParam==1)
m_UrlRegistry.DeleteValueKey(nhKeyRoot,nszS1KeyPath);
//重新增加BlockUrl子键
m_UrlRegistry.CreateKey(nhKeyRoot,nszS1KeyPath);
}
void CMainFrame::OnMenuExit()
{
// TODO: Add your command handler code here
SendMessage(WM_CLOSE,0,0);
}
LRESULT CMainFrame::OnTrayNotification(WPARAM wParam,LPARAM lParam)
{
return m_TrayIcon.OnTrayNotification(wParam,lParam);
}
void CMainFrame::OnHideWindow(WPARAM wParam,LPARAM lParam)
{
ShowWindow(SW_SHOWMINIMIZED);
ShowWindow(SW_HIDE);
UpdateWindow();
m_TrayIcon.m_bIsWindowNormal=FALSE;
m_bIsMainWindows=FALSE;
}
void CMainFrame::OnShowWindowL(WPARAM wParam,LPARAM lParam)
{
ShowWindow(SW_RESTORE);
SetForegroundWindow();
m_TrayIcon.m_bIsWindowNormal=TRUE;
m_bIsMainWindows=TRUE;
}
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CFrameWnd::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
// TODO: Add your message handler code here
//窗口被最小化时,将其缩成任务栏中的一个图标
if(nType==SIZE_MINIMIZED)
OnHideWindow(0,0);
}
void CMainFrame::OnHelpNote()
{
// TODO: Add your command handler code here
CString sDir;
sDir=m_InstallPath;
sDir+="\\LeoHelp.chm";
ShellExecute(NULL,"open",(LPCTSTR)sDir,NULL,NULL,SW_SHOWNORMAL);
}
void CMainFrame::WriteListInfo(LPCTSTR lpszText)
{
//CListViewInfo *pView=GetListViewInfo();
//pView->m_pListBoxInfo.AddString("afsfs");
}
void CMainFrame::OnTestList(WPARAM wParam,LPARAM lParam)
{
LPCTSTR lpcszText=(LPCTSTR)lParam;
CString str;
CListViewInfo *pView=GetListViewInfo();
pView->m_pListBoxInfo.AddString(lpcszText);
str=lpcszText;
m_strResonpontHeader+=str;
}
void CMainFrame::OnWriteReg2(WPARAM wParam,LPARAM lParam)
{
//Thread End ok
MAIN2_REGPARAM *pRegParam=(MAIN2_REGPARAM*)lParam;
int nItem=pRegParam->nItem;
//Write {Image,Speed}
CTestDownView *TestView=GetTestDownView();
LV_ITEM lItem;
lItem.mask=LVIF_IMAGE;
lItem.iItem=nItem;
lItem.iSubItem=0;
lItem.iImage=0;
TestView->m_ListNew.SetItem(&lItem);
TestView->m_ListNew.SetItemText(nItem,3,"100%");
TestView->m_ListNew.SetItemText(nItem,6,"00:00:00");
}
void CMainFrame::OnWriteRegMain(WPARAM wParam,LPARAM lParam)
{
MAIN_REGPARAM *pRegParam=(MAIN_REGPARAM*)lParam;
int iParam=(int)wParam;
//Write {FileLength,URL}
CString strLength,strFilePath;
strLength="";
strLength.Format("%ld",pRegParam->nLength);
strFilePath=pRegParam->strFilePath;
//Write to CView List
CTestDownView *TestView=GetTestDownView();
TestView->m_ListNew.SetItemText(pRegParam->nItem,1,(LPCTSTR)strFilePath);
TestView->m_ListNew.SetItemText(pRegParam->nItem,2,(LPCTSTR)strLength);
TestView->m_ListNew.SetColumnWidth(1,LVSCW_AUTOSIZE);
TestView->m_ListNew.SetColumnWidth(2,LVSCW_AUTOSIZE);
if(iParam==1)
{
BTOOLTEXT stToolText;
int nCount=m_ToolTipArray.GetSize();
int iItem=pRegParam->nItem;
for(int i=1;i<nCount;i++)
{
stToolText=m_ToolTipArray.GetAt(i);
if(iItem==stToolText.iItem)
{
m_ToolTipArray.RemoveAt(i);
break;
}
}
stToolText.strText=strFilePath;
stToolText.strText+="[0%]";
stToolText.iItem=iItem;
m_ToolTipArray.Add(stToolText);
m_strToolTip="";
nCount=m_ToolTipArray.GetSize();
for(i=1;i<nCount;i++)
{
stToolText=m_ToolTipArray.GetAt(i);
m_strToolTip+=stToolText.strText;
m_strToolTip+="\n";
}
m_strToolTip=m_strToolTip.Left(m_strToolTip.GetLength()-1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -