📄 myie.cpp
字号:
_rcProgress.bottom = _rcProgress.top + 15;
if( 0 == m_nURLType )
CreateStatusBar();
if (!(_hWndBrowser = CreateBrowser()))
return FALSE;
// LONG lStyle = GetWindowLong(_hWndBrowser, GWL_STYLE);
// SetWindowLong(_hWndBrowser, GWL_STYLE, lStyle|WS_BORDER);
///////////////////////////////////
//mod by ljf 2
/* dwStyle = GetWindowLong(_hWnd, GWL_STYLE);
if(_fFullScreen)
{
dwStyle |= (WS_OVERLAPPED | WS_SYSMENU | WS_THICKFRAME);
SetWindowLong(_hWnd, GWL_STYLE, dwStyle);
SetWindowPos(_hWnd,NULL, _rcWnd.left, _rcWnd.top, _rcWnd.right-_rcWnd.left, _rcWnd.bottom-_rcWnd.top, SWP_NOZORDER);
_fFullScreen = FALSE;
}
else
{
RECT rcWorkArea;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, 0);
_fFullScreen = TRUE;
dwStyle &= ~(WS_OVERLAPPED | WS_SYSMENU | WS_THICKFRAME);
SetWindowLong(_hWnd, GWL_STYLE, dwStyle);
SetWindowPos(_hWnd,NULL, rcWorkArea.left, rcWorkArea.top, rcWorkArea.right-rcWorkArea.left, rcWorkArea.bottom-rcWorkArea.top, SWP_NOZORDER);
}
*/
if( 0 == m_nURLType )
CreateCommandBar();
RECT rcWnd;
GetClientRect(_hWnd, &rcWnd);
int sbTop = 32;
if( 0 == m_nURLType )
sbTop = 0;
int sbHeight = rcWnd.bottom - rcWnd.top-sbTop;
if( _hWndCmdband )
{
RECT rcCmd;
GetClientRect(_hWndCmdband, &rcCmd);
sbHeight -= rcCmd.bottom;
sbTop += rcCmd.bottom;
// printf("%d,%d,%d,%d\n",rcCmd.left,rcCmd.right,rcCmd.top,rcCmd.bottom);
/* SetWindowPos(_hWndCmdband,
NULL,
32,
sbTop,
rcCmd.right-rcCmd.left,
rcCmd.bottom+32,
SWP_NOZORDER); */
}
if( _hWndStatus && _fShowStatusBar )
{
RECT rcStatus;
GetClientRect(_hWndStatus, &rcStatus);
sbHeight -= (rcStatus.bottom - rcStatus.top);
}
SetWindowPos(_hWndBrowser,
NULL,
0,
sbTop,
rcWnd.right-rcWnd.left,
sbHeight,
SWP_NOZORDER);
//////////////////////////////////
SetFocus(_hWnd);
_hAccelTbl = LoadAccelerators(g_hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR));
#ifdef START_FULLSCREEN
HandleCommand( ID_FULLSCREEN, 0 );
#endif
return TRUE;
}
#include "E:\pm_system\src\ce\pmHead\CustomConfig.h"
void CMainWnd::GetVersonInfo()
{
TCHAR szName[100]={0};
::GetModuleFileName(NULL,szName,sizeof(szName));
TCHAR* pp = _tcschr(szName,0);
while( *pp != _T('\\') )
pp--;
pp++;
// wprintf(L"%s\n",pp);
char fname[10]={0};
WideCharToMultiByte(CP_ACP, 0, pp, wcslen(pp),
fname, sizeof(fname), NULL, NULL);
CFuncConfig tabs;
tabs.ReadLists("funcs.lst");
TCHAR szVer[256]={0};
int ii = tabs.GetElementIDByName(fname);
TCHAR buf[256]={0};
wsprintf(buf,L"%s",m_szTitle);
tabs.FormatVersonInfo(ii,szVer,buf);
::MessageBox(_hWnd,szVer,_T("版本信息"),0);
}
void GetProxyOption()
{
INTERNET_PER_CONN_OPTION_LIST iOptionList;
INTERNET_PER_CONN_OPTION iOptions[3];
ULONG uSize = sizeof(iOptionList);
iOptionList.dwSize = uSize;
iOptionList.pszConnection = NULL;
iOptionList.dwOptionCount = 3;
iOptionList.pOptions = iOptions;
// set proxy type direct or proxy server
iOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
iOptions[1].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
iOptions[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
if(InternetQueryOption(NULL,INTERNET_OPTION_PER_CONNECTION_OPTION ,(LPVOID)(&iOptionList),&uSize))
{
GlobalFree(iOptionList.pOptions[1].Value.pszValue);
GlobalFree(iOptionList.pOptions[2].Value.pszValue);
}
}
BOOL CMainWnd::CreateStatusBar()
{
if (!(_hWndStatus = CreateStatusWindow(WS_CHILD|WS_VISIBLE, _T("IE"), _hWnd, ID_STATUSBAR)))//LOADSTRING(IDS_IE)
return FALSE;
RECT rc;
GetClientRect(_hWndStatus, &rc);
int naParts[5];
// naParts[4] = rc.right;
// naParts[3] = MAX(0, rc.right - MESSAGEPANEWIDTH);
// naParts[2] = MAX(0, rc.right - MESSAGEPANEWIDTH - ICONPANEWIDTH);
// naParts[1] = MAX(0, rc.right - MESSAGEPANEWIDTH - ICONPANEWIDTH - SECURITYPANEWIDTH);
// naParts[0] = MAX(0, rc.right - MESSAGEPANEWIDTH - ICONPANEWIDTH - SECURITYPANEWIDTH - PROGRESSPANEWIDTH);
naParts[1] = rc.right;
naParts[0] = MAX(0, rc.right - MESSAGEPANEWIDTH*2);
SendMessage(_hWndStatus, SB_SETPARTS, (WPARAM )2, (LPARAM)naParts);
SendMessage(_hWndStatus, SB_GETRECT, 1, (LPARAM )&rc);
InflateRect(&rc, -1,-1);
_hWndProgress = CreateWindowEx(0, PROGRESS_CLASS, _T(""), WS_CHILD|WS_VISIBLE|PBS_SMOOTH,
rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
_hWndStatus, NULL, g_hInstance, NULL);
if (0 == _hWndProgress)
return FALSE;
SendMessage(_hWndProgress, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
if(!_fShowStatusBar)
{
// make this appear like a toggle
_fShowStatusBar = TRUE;
//ShowStatusBar(FALSE);
}
return TRUE;
}
/*
BOOL CMainWnd::ShowStatusBar(BOOL fShow)
{
RECT rcWindow, rcStatus;
GetClientRect(_hWnd, &rcWindow);
GetClientRect(_hWndStatus, &rcStatus);
if((fShow ^ _fShowStatusBar) == 1)
{
if(!fShow)
{
SetParent(_hWndProgress, _hWnd);
ShowWindow(_hWndStatus, SW_HIDE);
_rcProgress.left = 5;
_rcProgress.right = _rcProgress.left + (_rcWnd.right - _rcWnd.left)/3;
_rcProgress.top = 5 + CommandBands_Height(_hWndCmdband);//(_fShowCmdBar ? CommandBands_Height(_hWndCmdband) : 0);
_rcProgress.bottom = _rcProgress.top + 15;
SetWindowPos(_hWndProgress, NULL, _rcProgress.left,_rcProgress.top,_rcProgress.right-_rcProgress.left,_rcProgress.bottom-_rcProgress.top,SWP_NOACTIVATE|SWP_HIDEWINDOW);
_fShowStatusBar = FALSE;
}
else
{
RECT rc;
SetParent(_hWndProgress, _hWndStatus);
SendMessage(_hWndStatus, SB_GETRECT, 1, (LPARAM )&rc);
InflateRect(&rc, -1,-1);
SetWindowPos(_hWndProgress, NULL, rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top,SWP_NOACTIVATE);
ShowWindow(_hWndStatus, SW_SHOW);
_fShowStatusBar = TRUE;
}
}
return TRUE;
}
*/
VOID CMainWnd::LoadTypedUrls()
{
TCHAR pszValName[10];
TCHAR *pszValData = NULL;
DWORD dwType = 0;
DWORD cbValName,cbData;
DWORD dwIndex = 0;
HKEY hKey = NULL;
LONG lRes = 0;
pszValData = new TCHAR[MAX_URL];
if(!pszValData)
goto Exit;
lRes = RegOpenKeyEx(HKEY_CURRENT_USER, szTypedUrls, 0, 0, &hKey);
if (hKey && lRes==ERROR_SUCCESS)
{
cbValName = 10;
cbData = sizeof(TCHAR)*MAX_URL;
while(ERROR_SUCCESS == RegEnumValue(hKey, dwIndex, pszValName, &cbValName, NULL, &dwType, (BYTE *)pszValData, &cbData))
{
dwIndex++;
SendMessage(_hWndAddressCombo, CB_INSERTSTRING, 0, (LPARAM )pszValData);
cbValName = 10;
cbData = sizeof(TCHAR)*MAX_URL;
}
}
delete [] pszValData;
Exit:
return;
}
VOID CMainWnd::SaveUrlList(void)
{
HKEY hKey = NULL;
TCHAR *szString=NULL; int cbString = 0;
DWORD dwDisp;
if(!_hWndAddressCombo)
return;
LONG lRes = RegCreateKeyEx(HKEY_CURRENT_USER, szTypedUrls, 0, NULL, 0, 0, 0, &hKey, &dwDisp);
if (hKey && lRes==ERROR_SUCCESS)
{
int nCount = SendMessage(_hWndAddressCombo, CB_GETCOUNT, 0, 0L);
int nLen;
TCHAR szValueName[7];
for (int i=0; i<nCount; i++)
{
nLen = SendMessage(_hWndAddressCombo, CB_GETLBTEXTLEN, i, 0L);
if (nLen==CB_ERR) {
delete szString; cbString = 0;
return;
}
if (nLen > cbString) {
delete szString; cbString = 0;
szString = new TCHAR[nLen+1];
cbString = nLen;
}
// pulled out of the if above, prefix isn't sure if the string is always valid here
// we'll catch it this way.
if (!szString)
break;
nLen = SendMessage(_hWndAddressCombo, CB_GETLBTEXT, i, (LPARAM )szString);
wsprintf(szValueName, _T("url%d"), i+1);
lRes = RegSetValueEx(hKey, szValueName, 0, REG_SZ, (BYTE *)szString, (_tcslen(szString)+1)*sizeof(TCHAR));
}
}
delete szString; cbString = 0;
// SetWindowLong(_hWndAddressEdit, GWL_WNDPROC, (LONG)_lpfnAddressEditProc);
}
VOID CMainWnd::UpdateUrlList(LPCTSTR lpszUrl)
{
int i = SendMessage(_hWndAddressCombo, CB_FINDSTRINGEXACT,
(WPARAM )-1, (LPARAM )lpszUrl);
if (i == CB_ERR)
{
SendMessage(_hWndAddressCombo, CB_INSERTSTRING, 0, (LPARAM )lpszUrl);
SendMessage(_hWndAddressCombo, CB_SETCURSEL,
(WPARAM)0, (LPARAM)0);
}
else
{
SendMessage(_hWndAddressCombo, CB_SETCURSEL,
(WPARAM)i, (LPARAM)0);
}
if ( (SendMessage(_hWndAddressCombo, CB_GETCOUNT, 0, 0L)) > MAXURLS)
{
SendMessage(_hWndAddressCombo, CB_DELETESTRING, MAXURLS-1, 0L);
}
}
VOID CMainWnd::SelChange()
{
TCHAR *szUrl;
int nRet, nRet1 = SendMessage(_hWndAddressCombo, CB_GETCURSEL, 0, 0L);
if (nRet1==CB_ERR)
return ;
nRet = SendMessage(_hWndAddressCombo, CB_GETLBTEXTLEN, nRet1, 0L);
if (nRet==CB_ERR)
return;
szUrl = new TCHAR[nRet+1];
if (szUrl)
{
SendMessage(_hWndAddressCombo, CB_GETLBTEXT, nRet1, (LPARAM )szUrl);
_pBrowser->Navigate(szUrl, NULL, NULL, NULL, NULL);
delete [] szUrl;
}
}
LRESULT CALLBACK CMainWnd::AddressEditProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
CMainWnd *pMainWnd = (CMainWnd*)GetWindowLong(hwnd, GWL_USERDATA);
if (!pMainWnd)
{
return 0;
}
if ((message == WM_CHAR) && (wParam == VK_RETURN))
{
int iSpaces = 0;
TCHAR *szString = new TCHAR[MAX_URL];
if(!szString)
goto Leave;
GetWindowText(hwnd, szString, MAX_URL);
// Remove preceding spaces.
for (iSpaces=0; szString[iSpaces] == _T(' '); iSpaces++);
pMainWnd->_pBrowser->Navigate(&szString[iSpaces], NULL, NULL, NULL, NULL);
pMainWnd->_bTyped = TRUE;
delete[] szString;
Leave:
return 0;
}
else
{
/*
if (message == WM_CHAR)
{
printf("char %x\n",wParam);
if( VK_BACK == wParam )
printf("vk back\n");
return 0;
}*/
if( WM_KEYUP == message && VK_BACK == wParam )
message = WM_CHAR;
//printf("msg=%d, %x\n",message,wParam);
//return 0;
return CallWindowProc(pMainWnd->_lpfnAddressEditProc, hwnd, message, wParam, lParam);
}
}
BOOL CMainWnd::CreateCommandBar()
{
//m_head.Create(NULL,OTHER_TOOLBAR);
//m_head.SetHintString(L"日程信息管理");
// m_foot.Create(NULL,&m_stbar,IDD_MYSTATUSBAR);
// m_foot.SetParent()
//RECT rct;
// GetClientRect(_hWnd, &rct);
// rct.top = rct.bottom-32;
// printf("%d,%d,%d,%d\n",rct.left,rct.right,rct.top,rct.bottom);
// HWND hdl = WinContainer.Create(_hWnd, rct,_T("{8856F961-340A-11D0-A96B-00C04FD705A2}"),//_T("{9D53EB71-F4DF-4312-8D05-12F8A103BC38}"),
// WS_CHILD|WS_VISIBLE);//|WS_VSCROLL );//create a browser control
// printf("_hWnd=%d,hwnd=%d\n",_hWnd,hdl);
// switch here between IE and shell command bars
return CreateIECommandBar(_fFullScreen, (TBBUTTON *)s_tbBtns, s_iBtns,0);
}
BOOL CMainWnd::CreateIECommandBar(BOOL fCloseBox, TBBUTTON *tbBtns, int numButtons, long idMenu)
{
/////////////////////////mod by ljf3
// Create the Address window and populate the Typed URL list
_hWndAddressCombo = CreateWindowEx(0, TEXT("combobox"), TEXT(""),
WS_VISIBLE | WS_CHILD |WS_TABSTOP| CBS_AUTOHSCROLL,
0, 0, 20, 110, _hWnd,
(HMENU)ID_ADDRESSBAR,
g_hInstance, NULL);
LoadTypedUrls();
// setup the edit control of the combobox
_hWndAddressEdit = GetDlgItem(_hWndAddressCombo, ID_COMBOEDIT);
if(_hWndAddressEdit)
{
SetWindowLong(_hWndAddressEdit, GWL_USERDATA, (DWORD)this);
_lpfnAddressEditProc = (WNDPROC )SetWindowLong(_hWndAddressEdit,
GWL_WNDPROC, (LONG)AddressEditProc);
SendMessage(_hWndAddressEdit, EM_LIMITTEXT, MAX_URL-1, 0L);
}
RECT rc;//HBITMAP hbm;
if(_hWndCmdband)
{
SaveUrlList();
DestroyWindow(_hWndCmdband);
}
/*
_himlCmdBand = ImageList_Create(11, 13, ILC_COLOR, 1, 0);
hbm = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_COOLBARIMAGES));
if (hbm)
{
ImageList_Add(_himlCmdBand, hbm, NULL);
DeleteObject(hbm);
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -