请高手帮助用delphi7写一个带Checkbox控件的程序,当Checkbox勾选的时候执行下面的C++程序模块

-->#include<windows.h>#include<winbase.h>intmain(){//Findwc3windowsHWNDhwar3=::FindWi... -->
#include < windows . h >
#include < winbase . h >
int main ()
{
//Find wc3 windows
HWND hwar3 =:: FindWindow ( NULL , "Warcraft III" );
HANDLE hcurrent = GetCurrentProcess ();
HANDLE hToken ;
BOOL bret = OpenProcessToken ( hcurrent , 40 ,& hToken );
LUID luid ;
bret = LookupPrivilegeValue ( NULL , "SeDebugPrivilege" ,& luid );
TOKEN_PRIVILEGES NewState , PreviousState ;
DWORD ReturnLength ;
NewState . PrivilegeCount = 1 ;
NewState . Privileges [ 0 ]. Luid = luid ;
NewState . Privileges [ 0 ]. Attributes = 2 ;
bret = AdjustTokenPrivileges ( hToken , FALSE ,& NewState , 28 ,& PreviousState ,& ReturnLength );
DWORD PID , TID ;
TID = :: GetWindowThreadProcessId ( hwar3 , & PID );
//Open wc3 process
HANDLE hopen = OpenProcess ( PROCESS_ALL_ACCESS | PROCESS_TERMINATE | PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE , FALSE , PID );

//Write memory
DWORD data = 0x74 ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F4069F0 ,& data , 1 , 0 );
data = 0x8B ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F406A0E ,& data , 1 , 0 );
data = 0x09 ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F406A0F ,& data , 1 , 0 );
data = 0x90 ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F406A10 ,& data , 1 , 0 );
data = 0x8B ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F406A13 ,& data , 1 , 0 );
data = 0x09 ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F406A14 ,& data , 1 , 0 );
data = 0x90 ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F406A15 ,& data , 1 , 0 );
data = 0x90 ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F29FE20 ,& data , 1 , 0 );
data = 0x90 ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F29FE21 ,& data , 1 , 0 );
data = 0x00 ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F149198 ,& data , 1 , 0 );
data = 0x40 ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F2A0803 ,& data , 1 , 0 );
data = 0x33 ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F2A0804 ,& data , 1 , 0 );
data = 0xC0 ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F2A0805 ,& data , 1 , 0 );
data = 0x42 ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F2A0806 ,& data , 1 , 0 );
data = 0x33 ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F2A0807 ,& data , 1 , 0 );
data = 0xD2 ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F2A0808 ,& data , 1 , 0 );
data = 0xEB ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F14A0B4 ,& data , 1 , 0 );
data = 0xEB ;
bret = WriteProcessMemory ( hopen ,( LPVOID ) 0x6F2A0703 ,& data , 1 , 0 );
//Close handle
bret = CloseHandle ( hopen );
return 0 ;
}

最好能把上面的C++程序用delphi7封装成DLL。
请把源程序打包发到904935780@qq.com 谢谢了!
2楼的能不能发个源程序给我,能不能在平台开不要紧,只要单机能开就可以研究了
展开
 我来答
cb120520025
2010-11-19 · TA获得超过347个赞
知道小有建树答主
回答量:323
采纳率:0%
帮助的人:569万
展开全部
//在Form的Create事件调用SetPrivilege来提升程序权限
//之后再调用ClearTheFog就可以清除迷雾了
//貌似该代码只能清除1.20的连常用的1.20e的都不行

procedure SetPrivilege;
var
OldTokenPrivileges, TokenPrivileges: TTokenPrivileges;
ReturnLength: dword;
hToken: THandle;
Luid: int64;
begin
OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES, hToken);
LookupPrivilegeValue(nil,'SeDebugPrivilege',Luid);
TokenPrivileges.Privileges[0].luid := Luid;
TokenPrivileges.PrivilegeCount := 1;
TokenPrivileges.Privileges[0].Attributes := 0;
AdjustTokenPrivileges(hToken, False, TokenPrivileges, SizeOf(TTokenPrivileges), OldTokenPrivileges, ReturnLength);
OldTokenPrivileges.Privileges[0].luid := Luid;
OldTokenPrivileges.PrivilegeCount := 1;
OldTokenPrivileges.Privileges[0].Attributes := TokenPrivileges.Privileges[0].Attributes or SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken, False, OldTokenPrivileges, ReturnLength, PTokenPrivileges(nil)^, ReturnLength);
end;

procedure ClearTheFog;
var
PID,data :DWORD;
hopen,hwar3 :THandle;
writeByte :Cardinal;
begin
hwar3 := FindWindow('Warcraft III','Warcraft III');
if hwar3 = 0 then
begin
ShowMessage('请先运行Warcraft III');
Exit;
end;
GetWindowThreadProcessId(hwar3,@PID);
hopen := OpenProcess(PROCESS_ALL_ACCESS or PROCESS_VM_OPERATION or PROCESS_VM_READ or PROCESS_VM_WRITE,FALSE,PID);
try
data := $74;
WriteProcessMemory(hopen,Pointer($6F4069F0),@data,1,writeByte);
data := $8B ;
WriteProcessMemory(hopen,Pointer($6F406A0E),@data,1,writeByte);
data := $09 ;
WriteProcessMemory(hopen,Pointer($6F406A0F),@data,1,writeByte);
data := $90 ;
WriteProcessMemory(hopen,Pointer($6F406A10),@data,1,writeByte);
data := $8B ;
WriteProcessMemory(hopen,Pointer($6F406A13),@data,1,writeByte);
data := $09 ;
WriteProcessMemory(hopen,Pointer($6F406A14),@data,1,writeByte);
data := $90 ;
WriteProcessMemory(hopen,Pointer($6F406A15),@data,1,writeByte);
data := $90 ;
WriteProcessMemory(hopen,Pointer($6F29FE20),@data,1,writeByte);
data := $90 ;
WriteProcessMemory(hopen,Pointer($6F29FE21),@data,1,writeByte);
data := $00 ;
WriteProcessMemory(hopen,Pointer($6F149198),@data,1,writeByte);
data := $40 ;
WriteProcessMemory(hopen,Pointer($6F2A0803),@data,1,writeByte);
data := $33 ;
WriteProcessMemory(hopen,Pointer($6F2A0804),@data,1,writeByte);
data := $C0 ;
WriteProcessMemory(hopen,Pointer($6F2A0805),@data,1,writeByte);
data := $42;
WriteProcessMemory(hopen,Pointer($6F2A0806),@data,1,writeByte);
data := $33;
WriteProcessMemory(hopen,Pointer($6F2A0807),@data,1,writeByte);
data := $D2;
WriteProcessMemory(hopen,Pointer($6F2A0808),@data,1,writeByte);
data := $EB;
WriteProcessMemory(hopen,Pointer($6F14A0B4),@data,1,writeByte);
data := $EB;
WriteProcessMemory(hopen,Pointer($6F2A0703),@data,1,writeByte);
finally
CloseHandle(hopen);
end;
end;
lhywjb
2010-11-18 · 超过13用户采纳过TA的回答
知道答主
回答量:25
采纳率:0%
帮助的人:0
展开全部
那你干嘛不把这段c++代码弄成dll,然后让delphi调用呢?delphi和c在某些是不能通用的,这么调用很有难度,但是他们可以通过dll来衔接。
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
kcxnvbdbd
2010-11-21 · TA获得超过523个赞
知道小有建树答主
回答量:885
采纳率:50%
帮助的人:612万
展开全部
开魔兽战争迷雾的吧, 我自己也用delphi写了个一样的功能,不过一开平台就无效了

邮件已发
地址是我自己查找的,目前仅找了1.20e这个版本的地址
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式