static HINSTANCE hMyMyNtQuerySystemInformation;
int (_cdecl *pfnHook)(DWORD);
  hMyMyNtQuerySystemInformation= LoadLibrary(("QSI.dll"));
  if(hMyMyNtQuerySystemInformation){
    pfnHook = (int(*)(DWORD))GetProcAddresshMyMyNtQuerySystemInformation,"Hook");
   pfnHook(GetCurrentProcessId());
}
  else{
    MessageBox(NULL,("Failed to load HookNTQSI.dll "),NULL,MB_OK | MB_APPLMODAL | MB_ICONWARNING);
}procedure TForm1.Button1Click(Sender: TObject);
var
   pfnHook: function(dwProcessID: DWord): integer; CDecl;
   DllName:string;
   Buffer:array [0..127] of char;
   hLib: Cardinal;
begin
    DllName:='QSI.dll';
    strPcopy(buffer,Dllname);
    hLib := LoadLibrary(buffer);
    if hLib <> 0 then begin
        try
          @pfnHook := GetProcAddress(hLib, 'Hook');
          if pfnHook(GetCurrentProcessId)>0 then
             MessageDlg('调用函数成功!',mtInformation,[mbOk],0)
          else
             MessageDlg('调用函数失败!',mtError,[mbOk],0);
        finally
          FreeLibrary(hLib);
        end;
    end else begin
        MessageDlg('载入库失败!',mtError,[mbOk],0);
    end;
end;

解决方案 »

  1.   

    试试
    procedure TForm1.Button1Click(Sender: TObject);
    var
       pfnHook: function(dwProcessID: DWord): integer; CDecl;;
      hLib: Cardinal;
    begin
        hLib := LoadLibrary('QSI.dll');
        if hLib <> 0 then begin
            try
              @pfnHook := Pointer(GetProcAddress(hLib, 'Hook'));
              if Assigned(@pfnHook) then
              begin
                 pfnHook(GetCurrentProcessId());
                 MessageDlg('调用函数成功!',mtInformation,[mbOk],0)
              end
              else
                 MessageDlg('调用函数失败!',mtError,[mbOk],0);
            finally
              FreeLibrary(hLib);
            end;
        end
        else
            MessageDlg('载入库失败!',mtError,[mbOk],0);
    end;
      

  2.   

    不敢保证一定是对的。
    pfnHook: function(dwProcessID: DWord): integer; CDecl;;不好意思写成两个“;”了
      

  3.   

    怎么,vc转delphi也可以?
    那么有没有c++转delphi的?
      

  4.   

    手工转的。C++转Delphi基本上不会有很大问题~~~~只是C++有好多Delphi不支持的特性,例如重载操作符,模版等。