我把自己的DLL注入到所有的EXE里!但我只想QQ来运行我DLL!不过放心,我发誓绝对不是盗密码的
程序!这个请放心!请问这么才可以在我的DLL判断该程序是不是QQ呢  

解决方案 »

  1.   

    楼主,试试以下的Var
       CurrentProcessId, Snapshot: DWord;
       MsgProcess: PROCESSENTRY32;
    begin
          CurrentProcessId := CurrentProcessId(); // 获得当前(你的)进程的ID
          Snapshot:=CreateToolhelp32Snapsho(TH32CS_SNAPPROCESS,CurrentProcessId) ;
          MsgProcess.dwSize := 296 ;
          // 获得第一个进程
          Process32First(Snapshot, MsgProcess) ;
          // 循环取列举的进程
          While (True) Do
            Begin
                If Process32Next(Snapshot,MsgProcess)= False Then Exit;
                If (MsgProcess.szExeFile='QQ.exe') Then
                  begin
                    If MsgProcess.th32ProcessID= CurrentProcessId Then
                      ShowMessage('该程序是QQ');  
                  end ;  
            End ;end;// 楼主,能不能把注入Exe 的代码 贴出来,大家一起学习!
      

  2.   

    呵呵,楼上的,如果QQ的可执行程序的程序名不是QQ.exe,你的代码还有用吗??:)
      

  3.   

    那就查一下application.title 或窗体的caption  或程序有没有用到QQ中的DLL
    ====================================================================像和尚的唐僧
      

  4.   

    d0347朋友的代码有小小的错误,跑不起来,我改了一下,大家可以跑它了:
    procedure TForm1.Button1Click(Sender: TObject);
    Var
       CurrentProcessId, Snapshot: DWord;
       MsgProcess: PROCESSENTRY32;
       temp:string;
    begin
          CurrentProcessId := GetCurrentProcess(); // 获得当前(你的)进程的ID
          Snapshot:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,CurrentProcessId) ;
          MsgProcess.dwSize := 296 ;
          // 获得第一个进程
          Process32First(Snapshot, MsgProcess) ;
          // 循环取列举的进程
          While (True) Do
            Begin
                If Process32Next(Snapshot,MsgProcess)= False Then Exit;
                temp:=MsgProcess.szExeFile;
                If (temp='smss.exe') Then
                  begin
                    //If MsgProcess.th32ProcessID= CurrentProcessId Then
                      ShowMessage(Format('找到已运行程序smss.exe,进程大小=%d字节,进程ID=%d',[MsgProcess.dwSize,MsgProcess.th32ProcessID]));
                  end ;
            End ;end;
      

  5.   

    当前正在运行的程序的文件名列表    
        
    uses tlhelp32;--------------varlppe:tprocessentry32;sshandle:thandle;found:boolean;beginsshandle:=createtoolhelp32snapshot(th32cs_snapail,0);found:=process32first(sshandle,lppe);while found dobegin//进行你的处理其中lppe.szExefile就是程序名。found:=proccess32next(sshandle,lppe);end;end;//线程用Thread32First,Thread32Next//模块用Module32First,Module32Next//堆用Heap32First,Heap32Next//可执行文件用process32first
     
     
      

  6.   

    通过进程方式来判断当前系统进程当中是否包含着 QQ.exe 是一种比较简单的办法!不过如果对方把可执行文件名修改了之后就不容易判断了~~~或者根据 QQ.exe 当中的识别码也是一种非常好的判断手段,只是不知道每种版本的QQ的识别码是否都是一样~~~~