joe85231 发表于 2011-4-1 15:16:07

请问这个函数哪里有问题谢谢

function GetRoleBase(biaotie:string):integer;
var
ptmp:integer;
readByte:Dword;
begin
   result:=0;
   thWnd := FindWindow(nil,pchar(biaotie.text));//查找窗口,nil空。pchar在易语言里不用转换
                                                //PChar是以null结尾的字符型指针,Pointer是无类型的指针。string可以兼容pchar,反过来就要进行转化如
   jubinge.Text :=inttostr(thwnd)   ;          //inttostr是把整数转换文本,像易语言的到文本
   pid2 := GetWindowThreadProcessId(thwnd,@pid);
   jinchengide.Text :=inttostr(pid)   ;       //进程
   xianchengide.Text :=inttostr(pid2)   ;      //线程
   phandle := OpenProcess(2035711,False,pid);   //打开句柄

result:=ptmp;
end;

cywsh 发表于 2011-4-1 15:16:29

result:=ptmp;
你这个返回值是从那儿来的?

joe85231 发表于 2011-4-1 15:16:57

我写这个目的是想写一个全局函数比如功能:
打开的时候先记录 人物经验
然后一个时间刷新的子程序不停的刷新,跟之前的初始经验对比这样就能知道一共获得了多少经验值,这个思路怎么写高手指教一下谢谢

Qrimkiss 发表于 2011-4-1 15:17:09

个人的一些思路,没测试过,参考参考


var
CountExpOrg , CountExpEnd ,CountTime: dword;      //Org初始经验,End最后经验,CountTime计数器
CountExpArg:dword;//Arg平均经验


procedure TForm1.Button1Click(Sender: TObject); //挂机开始钮
begin
.....
CountExpTimer.Enabled := True; //开始timer
CountTime:=0; //初始化计数器
CountExpOrg:=W2I_ROLE_EXPER; //记录刚开始经验
......
end;

procedure TForm1.CountExpTimer(Sender: TObject);//设定为间隔1秒
begin
CountTime:=CountTime+1;//秒数计数器,每秒+1
CountExpEnd:=W2I_ROLE_EXPER; //记录最后经验
CountExpArg:= Round ((3600/CountTime)*(CountExpEnd-CountExpOrg)); //每小时获得之平均经验
end;
页: [1]
查看完整版本: 请问这个函数哪里有问题谢谢