📄 qqllk.dpr
字号:
{*************************************************
Copyright (C), 2004, 风月工作室.
作者: 追风逐月
版本: 1.0
日期: 2005年02月01日
描述:
修改历史:
徐明 2005/02/01 1.0 创建该文件
...
*************************************************}
{$J+}
program QQLLK;
uses
Windows,
Messages,
SysUtils,
ShellAPI,
LineGame in 'LineGame.pas';
{$R qqllk.res}
const
////////////////
//资源常量定义// ;不要修改!
////////////////
MAINICON = 'MAINICON';
IDD_MAINDLG = 1000;
MAIN_SINGLE = 1002;
MAIN_ALL = 1003;
MAIN_OPTION = 1006;
MAIN_ABOUT = 1001;
MAIN_EXIT = 1004;
IDD_ABOUTDLG = 3000;
ABOUT_OK = 3001;
ABOUT_CLOSE = 3002;
ABOUT_FILE = 3003;
ABOUT_AUTHOR = 3004;
ABOUT_MEMO = 3005;
IDD_OPTIONDLG = 2000;
OPTION_OK = 2001;
OPTION_CANCEL = 2002;
OPTION_ABOUT = 2003;
OPTION_CLOSE = 2004;
OPTION_AUTOSTART = 1000;
OPTION_AUTOTOOLS = 1001;
OPTION_RANDOM = 1006;
OPTION_COMPUTER = 1007;
OPTION_TIMER = 1008;
const
////////////////
//常量数据声明//
////////////////
(*颜色设定*)
//clBackground = $8B190B; //背景颜色
clBackground = $87D34; //背景颜色
clText = $E4E4E4; //文字颜色
//clFrom = $871200; //标题栏渐变起始颜色
//clTo = $808080; //标题栏渐变结束颜色
clFrom = $87D34; //标题栏渐变起始颜色
clTo = $808080; //标题栏渐变结束颜色
ID_HOTKEYF2 = 200; //热键F2
ID_HOTKEYF3 = 300; //热键F3
ID_HOTKEYCTRLF4 = 400; //热键CTRL+F4
szMainCaption = 'QQ连连看外挂';
{*选项对话框*}
szOptionCaption = '选项'; //关于对话框标题
(*关于对话框*)
szAboutCaption = '关于 QQ连连看外挂'; //关于对话框标题
szFile = '版本 1.1.0.0'; //注册机说明
szAuthor = '『由[追风逐月]编写』'; //注册机作者
szGreet = //字幕内容每行不要超过32个字符(16个汉字)
'本软件由风月工作室出品'#10#10 + '〖联系方式〗'#10#10'coolchyni@gmail.com'#10#10+
'〖快捷键〗'#10#10+'F2:消除一组对子'#10'F3:消除所有对子'#10'CTRL+F4:显示/隐藏窗口'#10#10+
'〖特别感谢〗'#10#10+
'各位QQ游戏爱好者'#10'我的哥们'#10'以及所有曾帮助过我的人'#10#10 +
'〖免责声明〗'#10#10'本软件属于免费软件'#10'可以自由使用'#10'由此造成的一切后果(如QQ号被封)'#10'均与作者无关'#10#10 +
'〖版本信息〗'#10#10'[1.0.0.0]'#10'实现外挂程序基本功能'#10'[1.1.0.0]'#10'使用内存补丁的方法,'#10'去掉了原程序包中的连连看替换文件.'#10' ' ;
var
BKC: HBRUSH; //背景画刷
//h_Cur: HCURSOR; //鼠标指针句柄
h_Inst: HINST; //程序图标句柄
h_Icon: HICON; //实例句柄
h_mainDlg: HWND;
g_AutoStart: boolean = false; //自动开始
g_AutoTools: boolean = false; //自动使用工具
g_Random: boolean = false; //隐藏窗口
g_Computer: boolean = false; //电脑托管
g_timer: array[0..254] of char = '1000'; //消除频率
g_internal:integer=1000; //定时间隔
LineGames: TLineGame; //游戏类
function LinesInStr(srcStr: string): smallint;
var
i: integer;
begin
Result := 1;
for i := 0 to Length(srcStr) - 1 do
if srcStr[i] = #10 then
Result := Result + 1;
if Result > 1 then
Result := Result - 1;
end;
//////////////////////////////////////////////////////////////////
//动态显示窗体函数
procedure AnimateShow(hDlg: HWND);
var
Rt: TRECT;
x, y, i: smallint;
h_Rgn: HRGN;
begin
ShowWindow(hDlg, SW_HIDE);
GetWindowRect(hDlg, Rt);
x := (Rt.right - Rt.left) div 2;
y := (Rt.bottom - Rt.top) div 2;
for i := 0 to (Rt.Right div 2) do
begin
h_Rgn := CreateRectRgn(x - i, y - i, x + i, y + i);
SetWindowRgn(hDlg, h_Rgn, True);
ShowWindow(hDlg, SW_SHOW);
DeleteObject(h_Rgn);
end;
SetWindowPos(hDlg, HWND_TOPMOST, rt.Left, rt.Top, rt.Right - rt.Left, rt.Bottom
- rt.Top, 0);
end;
//////////////////////////////////////////////////////////////
//绘制标题栏函数
//hDC: 绘制窗体的设备环境句柄
//hIco: 标题栏图标句柄
//szCaption: 标题栏标题
//rect: 标题栏矩形区域
//clBegin: 标题栏渐变起始颜色
//clEnd: 标题栏渐变结束颜色
procedure PaintCaption(h_DC: HDC; h_Ico: HICON; const szCaption: string; rect:
TRECT;
clBegin: COLORREF; clEnd: COLORREF);
var
brush: HBRUSH;
_logbrush: LOGBRUSH; //上色画刷
colorrect: TRECT; //上色矩形区域
h_font: HFONT; //标题栏字体
Haf, i: smallint;
R, G, B, fr, fg, fb, dr, dg, db: smallint;
begin
fr := GetRValue(clFrom); //分解颜色
fg := GetGValue(clFrom);
fb := GetBValue(clFrom);
dr := GetRValue(clTo);
dg := GetGValue(clTo);
db := GetBValue(clTo);
Haf := (rect.right - rect.left) div 2; //计算标题栏矩形区域中心
//设定上色矩形区域高度
colorrect.top := 0;
colorrect.bottom := rect.bottom - rect.top;
//建立渐变上色画刷
_logbrush.lbStyle := BS_SOLID;
_logbrush.lbHatch := 0;
for i := 0 to Haf do
begin
//设定左半上色矩形区域一次填充位置
colorrect.left := MulDiv(i, Haf, Haf);
colorrect.right := MulDiv(i + 1, Haf, Haf);
//颜色渐变
R := fr + MulDiv(i, dr, Haf);
G := fg + MulDiv(i, dg, Haf);
B := fb + MulDiv(i, db, Haf);
if (R > 255) then
R := 255;
if (G > 255) then
G := 255;
if (B > 255) then
B := 255;
_logbrush.lbColor := RGB(R, G, B);
brush := CreateBrushIndirect(_logbrush);
FillRect(h_DC, colorrect, brush); //填充左半区域
//设定右半上色矩形区域一次填充位置
colorrect.left := (rect.right - rect.left) - (MulDiv(i, Haf, Haf));
colorrect.right := (rect.right - rect.left) - (MulDiv(i + 1, Haf, Haf));
FillRect(h_DC, colorrect, brush); //填充右半区域
DeleteObject(brush);
end;
_logbrush.lbColor := $9E6A54;
brush := CreateBrushIndirect(_logbrush);
FrameRect(h_DC, rect, brush); //绘制标题栏边框
DeleteObject(brush);
SetTextColor(h_DC, $FFFFFF);
SetBkMode(h_DC, TRANSPARENT); //设定标题栏字体属性
rect.left := 2;
rect.top := 2;
rect.bottom := rect.Bottom - 2;
h_font := CreateFont(-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH or FF_DONTCARE, '宋体');
//(宋体9号粗体字)
SelectObject(h_DC, h_font);
if h_Ico <> 0 then //若有图标则会制图标
begin
DrawIconEx(h_DC, 2, 2, h_Ico, 16, 16, 0, 0, DI_NORMAL);
rect.left := 20;
end;
//绘制标题栏标题
DrawText(h_DC, PChar(szCaption), -1, rect, DT_SINGLELINE or DT_VCENTER);
DeleteObject(h_font);
end;
//////////////////////////////////////////////////////////////
//绘制按钮函数
//pdis: 绘制内容结构指针
procedure DrawButton(pdis: PDRAWITEMSTRUCT);
var
szText: array[0..9] of char; //按钮文字
begin
FillRect(pdis.hDC, pdis.rcItem, BKC); //以背景色填充按钮
SetTextColor(pdis.hDC, clText);
SetBkMode(pdis.hDC, TRANSPARENT);
//尚未点击,绘制按钮边框-突起状态
DrawEdge(pdis.hDC, pdis.rcItem, BDR_RAISEDOUTER, BF_RECT);
GetWindowText(pdis.hwndItem, szText, sizeof(szText));
DrawText(pdis.hDC, szText, -1, pdis.rcItem, DT_SINGLELINE or DT_CENTER or
DT_VCENTER);
//已被按下,绘制按钮边框-凹陷状态
//if (pdis.itemState and ODS_SELECTED)=ODS_SELECTED then
if (pdis.itemState and ODS_SELECTED) <> 0 then
begin
SetTextColor(pdis.hDC, $00DDFF);
DrawText(pdis.hDC, szText, -1, pdis.rcItem, DT_SINGLELINE or DT_CENTER or
DT_VCENTER);
DrawEdge(pdis.hDC, pdis.rcItem, BDR_SUNKENOUTER, BF_RECT);
end;
end;
function ScrollProc(h_Wnd: HWND; Msg, wParam, lParam: DWORD): LRESULT; stdcall;
var
h_DC: HDC;
ps: TPAINTSTRUCT;
rc: TRECT;
h_font: HFONT;
begin
case Msg of
WM_PAINT:
begin
//绘制字幕内容
h_DC := BeginPaint(h_Wnd, ps);
GetClientRect(h_Wnd, rc);
SetTextColor(h_DC, clText);
SetBkMode(h_DC, TRANSPARENT);
h_font := CreateFont(-12, 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH
or FF_DONTCARE, '宋体');
SelectObject(h_DC, h_font);
DrawText(h_DC, szGreet, -1, rc, DT_CENTER);
EndPaint(h_Wnd, ps);
DeleteObject(h_font);
end;
else
begin
//l:=GetWindowLong(h_Wnd,GWL_USERDATA);
//CallWindowProc(@l,h_Wnd,Msg,wParam,lParam);
end;
end;
result := 1;
end;
function AboutProc(hDlg: HWND; Msg, wParam, lParam: DWORD): LRESULT; stdcall;
const
rcCaption: TRECT = ();
i: smallint = 0;
w: smallint = 0;
h: smallint = 0;
h_Memo: HWND = 0;
memo: HWND = 0;
lines: smallint = 1; //字幕行数
var
h_dc: HDC;
ps: TPAINTSTRUCT;
pdis: PDRAWITEMSTRUCT;
pt: TPOINT;
rcMemo: TRECT;
lUser: integer;
h_Font: HFONT;
h_File: HWND;
begin
case Msg of
WM_INITDIALOG:
begin
GetClientRect(hDlg, rcCaption);
rcCaption.bottom := rcCaption.top + 20;
h_Memo := GetDlgItem(hDlg, ABOUT_MEMO);
h_File := GetDlgItem(hDlg, ABOUT_FILE);
h_Font := CreateFont(-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH
or FF_DONTCARE, '宋体');
SendMessage(h_File, WM_SETFONT, h_Font, 0);
SetDlgItemText(hDlg, ABOUT_FILE, szFile);
SetDlgItemText(hDlg, ABOUT_AUTHOR, szAuthor);
SetWindowText(hDlg, szAboutCaption);
GetClientRect(h_Memo, rcMemo); //得到字幕显示区域大小
w := rcMemo.right - rcMemo.left;
h := rcMemo.bottom - rcMemo.top;
i := h;
lines := LinesInStr(szGreet); //计算字幕行数
//建立显示字幕子窗体
memo := CreateWindow('Static', '', WS_VISIBLE or WS_CHILD or SS_CENTER,
0, h, w, 12 * lines, h_Memo, 0, h_Inst, nil);
//设定子窗体消息处理函数
lUser := SetWindowLong(memo, GWL_WNDPROC, integer(@ScrollProc));
SetWindowLong(memo, GWL_USERDATA, lUser);
AnimateShow(hDlg);
SetTimer(hDlg, 168, 80, nil); //设定定时器每80毫秒触发一次
result := 1;
end;
WM_TIMER:
begin
//定时器触发时移动子窗体,形成字幕
Sleep(20);
i := i - 1;
SetWindowPos(memo, 0, 0, i, w, 12 * lines, 0);
if (-(i + (12 * lines)) > 0) then
i := h; //字幕到达尾部时,重新开始循环
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -