📄 stdafx.cpp
字号:
/************************************
REVISION LOG ENTRY
Revision By: Zhang, Zhefu
Contact: codetiger@hotmail.com
Revised on 12/7/2002 10:44:33 AM
Comment: Following Source is Written To Contribute to WWW.CodeGuru.Com
Also check http://codeguru.earthweb.com/ieprogram/SPwdSpy.html
for latest patch
************************************/
// stdafx.cpp : source file that includes just the standard includes
// SuperPwdSpy.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
BOOL IsBrowser(HWND hWnd)
{
TCHAR szClassName[64];
int nRet = GetClassName(hWnd, szClassName, 64);
if(nRet == 0) return FALSE;
szClassName[nRet] = 0;
if(::lstrcmp(szClassName,
_T("Internet Explorer_Server")
) != 0) return FALSE;
return TRUE;
}
BOOL IsPasswordEdit(HWND hWnd)
{
TCHAR szClassName[64];
int nRet = GetClassName(hWnd, szClassName, 64);
if(nRet == 0) return FALSE;
szClassName[nRet] = 0;
if(::lstrcmp(szClassName, _T("Edit")) != 0
&& ::lstrcmp(szClassName, _T("TEdit")) != 0
&& ::lstrcmp(szClassName, _T("ThunderTextBox")) != 0) return FALSE;
DWORD dw = ::GetWindowLong(hWnd,GWL_STYLE);
dw &= ES_PASSWORD;
if(dw == ES_PASSWORD)
return TRUE;
return FALSE;
}
//From MSDN Spy Sample
void HighlightWindow(HWND hwnd, BOOL fDraw)
{
#define DINV 3
HDC hdc;
RECT rc;
BOOL bBorderOn;
bBorderOn = fDraw;
if (hwnd == NULL || !IsWindow(hwnd))
return;
hdc = ::GetWindowDC(hwnd);
::GetWindowRect(hwnd, &rc);
::OffsetRect(&rc, -rc.left, -rc.top);
if (!IsRectEmpty(&rc))
{
PatBlt(hdc, rc.left, rc.top, rc.right - rc.left, DINV, DSTINVERT);
PatBlt(hdc, rc.left, rc.bottom - DINV, DINV,
-(rc.bottom - rc.top - 2 * DINV), DSTINVERT);
PatBlt(hdc, rc.right - DINV, rc.top + DINV, DINV,
rc.bottom - rc.top - 2 * DINV, DSTINVERT);
PatBlt(hdc, rc.right, rc.bottom - DINV, -(rc.right - rc.left),
DINV, DSTINVERT);
}
::ReleaseDC(hwnd, hdc);
}
HWND XYZWindowFromPoint(HWND hwndParent, // handle to parent window
POINT point, // structure with point coordinates
UINT uFlags // skip options
)
{
if(hwndParent != NULL)
return ::ChildWindowFromPointEx(hwndParent, point, uFlags);
// Find the smallest "window" still containing the point
// Doing this prevents us from stopping at the first window containing the point
RECT rect, rectSearch;
HWND pWnd, hWnd, hSearchWnd;
hWnd = ::WindowFromPoint(point);
if(hWnd != NULL)
{
// Get the size and parent for compare later
::GetWindowRect(hWnd, &rect);
pWnd = ::GetParent(hWnd);
// We only search further if the window has a parent
if(pWnd != NULL)
{
// Search from the window down in the Z-Order
hSearchWnd = hWnd;
do{
hSearchWnd = ::GetWindow(hSearchWnd, GW_HWNDNEXT);
// Does the search window also contain the point, have the same parent, and is visible?
::GetWindowRect(hSearchWnd, &rectSearch);
if(::PtInRect(&rectSearch, point) && ::GetParent(hSearchWnd) == pWnd && ::IsWindowVisible(hSearchWnd))
{
// It does, but is it smaller?
if(((rectSearch.right - rectSearch.left) * (rectSearch.bottom - rectSearch.top)) < ((rect.right - rect.left) * (rect.bottom - rect.top)))
{
// Found new smaller window, update compare window
hWnd = hSearchWnd;
::GetWindowRect(hWnd, &rect);
}
}
}while(hSearchWnd != NULL);
}
}
return hWnd;
}
void PopMsg(LPCTSTR pszFormat, ...)
{
va_list argList;
va_start(argList, pszFormat);
TCHAR sz[1024];
//#ifdef _UNICODE
// vswprintf(sz, pszFormat, argList);
//#else
// vsprintf(sz, pszFormat, argList);
//#endif
wvsprintf(sz, pszFormat, argList);
va_end(argList);
::MessageBox(NULL, sz, _T("Pop Msg"), MB_OK);
}
void ReportErr(LPCTSTR str)
{
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
::GetLastError(),
MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
::MessageBox( NULL, (LPCTSTR)lpMsgBuf,
str, MB_OK | MB_ICONINFORMATION );
// Free the buffer.
LocalFree( lpMsgBuf );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -