📄 greenbrowser.cpp
字号:
//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);
//auto scroll
WriteProfileInt("Settings", "AutoScrollAfterDL", pmf->m_bDefScrollAfterDL);
WriteProfileInt("Settings", "UseAutoScroll", pmf->m_bDefUseAutoScroll);
WriteProfileInt("Settings", "SrSpeed", pmf->m_nDefSrSpeed);
WriteProfileInt("Settings", "AutoScrollPage", pmf->m_nAutoScrollPage);
//start group
WriteProfileString("Settings", "StartGroup", pmf->m_strStartGroup);
//default bg color
WriteProfileString("Settings", "BGColor", pmf->m_strBGColor);
//default auto refresh
WriteProfileInt("Settings", "AutoRefresh", pmf->m_nDefRefreshInterval);
//toolbar icon
WriteProfileInt("Settings", "SmallToolbar", pmf->m_bSmallToolBar);
//auto set background
WriteProfileInt("Settings", "AutoSetBG", g_bAutoSetBG);
WriteProfileInt("Settings", "AnimateIcon", pmf->m_bAnimatIcon);
WriteProfileInt("Settings", "LockHomepage", g_bLockHomepage);
WriteProfileInt("Settings", "MouseCtrlSpeed", pmf->m_bMouseCtrlScrSpeed);
//lock toolbar
WriteProfileInt("Settings", "LockToolbar", pmf->m_bLockToolbar);
// search key
pmf->SaveSearchKey();
//
WriteProfileInt("Settings", "DefaultCharSet", pmf->m_nDefaultCharSet);
//
WriteProfileInt("Settings", "GroupMenuShowMember", pmf->m_bGroupMenuShowMember);
WriteProfileInt("Settings", "CloseAllBeforeNewGroup", pmf->m_bCloseAllBeforeNewGroup);
//
WriteProfileInt("Settings", "DirectOpenFile", pmf->m_bDirectOpenFile);
WriteProfileInt("Settings", "OpenInNew", pmf->m_bOpenInNew);
//
WriteProfileInt("Settings", "DisableBackground", pmf->m_bDisableBackground);
//
WriteProfileInt("Settings", "AutoRefreshActive", pmf->m_bAutoRefreshActive);
//
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 );
WriteProfileString("Settings", "SortSaveFolder", pmf->m_strSortSaveFolder);
WriteProfileInt("Settings", "ShowSortSaveDlg", pmf->m_bShowSortSaveDlg );
}catch(...){}
}
BOOL CGreenBrowserApp::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 CGreenBrowserApp::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
}
//#######################################################################################
CGreenBrowserModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_GreenBrowserNSHandle, CGreenBrowserNSHandle)
END_OBJECT_MAP()
LONG CGreenBrowserModule::Unlock()
{
AfxOleUnlockApp();
return 0;
}
LONG CGreenBrowserModule::Lock()
{
AfxOleLockApp();
return 1;
}
LPCTSTR CGreenBrowserModule::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 CGreenBrowserApp::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_GreenBrowser, FALSE);
_Module.UnregisterServer(TRUE); //TRUE means typelib is unreg'd
bRun = FALSE;
break;
}
if (lstrcmpi(lpszToken, _T("RegServer"))==0)
{
_Module.UpdateRegistryFromResource(IDR_GreenBrowser, 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 CGreenBrowserApp::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()
{
#ifdef _WRITE_LNG_FILE_
_WriteDlgString(this,"DialogAbout");
this->OnCancel();
return TRUE;
#endif
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 + -