Guest User

Delphi Source to access rufid.dll

a guest
Jul 11th, 2010
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 2.86 KB | None | 0 0
  1. unit ruflightu;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, DdeMan;
  8.  
  9. type
  10.   TitelArray            = Array[1..5] of Byte;
  11.  
  12.   PDLLEintrag           = ^TDLLEintrag;
  13.   TDLLEintrag           = Packed Record
  14.     Markiert          : Boolean;
  15.  
  16.     Titel             : TitelArray;
  17.  
  18.     Adel              : Byte;
  19.     NameVorsatz       : Byte;
  20.     NameZusatz        : Byte;
  21.  
  22.     Geschlecht        : Byte;
  23.     Vorname           : String[30];
  24.     Anrede            : String[10];
  25.     Name              : String[120];
  26.     Zusatz            : String[120];
  27.     Ortsteil          : String[40];
  28.     Strasse           : String[46];
  29.     Hausnummer        : String[10];
  30.     HausnummerZusatz  : String[20];
  31.     Land              : String[3];
  32.     PLZ               : String[5];
  33.     Ort               : String[70];
  34.     Vorwahl           : String[10];
  35.     TelZusatz         : String[15];
  36.     Telefon           : String[20];
  37.   end;
  38.  
  39.   PDLLArray             = ^TDLLArray;
  40.   TDLLArray             = Array[1..1] of TDLLEintrag;
  41.  
  42.  
  43.   TUseVersion = procedure(V : Byte); stdcall;
  44.   TSucheTelefonnummer = procedure( Nummer : PChar; var EintragListe : PDLLEintrag;
  45.                                    var EintragAnzahl : LongInt ); stdcall;
  46.  
  47.  
  48.   TForm1 = class(TForm)
  49.     Button1: TButton;
  50.     Edit1: TEdit;
  51.     ListBox1: TListBox;
  52.     RadioButton1: TRadioButton;
  53.     RadioButton2: TRadioButton;
  54.     procedure Button1Click(Sender: TObject);
  55.     procedure RadioButton2Click(Sender: TObject);
  56.     procedure RadioButton1Click(Sender: TObject);
  57.   private
  58.     { Private-Deklarationen }
  59.     DllHdl : THandle;
  60.   public
  61.     { Public-Deklarationen }
  62.   end;
  63.  
  64.  
  65. var
  66.  Form1 : TForm1;
  67.  
  68.  DllHdl : THandle;
  69.  FuncPtr : TFarProc;
  70.  PSucheTelefonnummer : TSucheTelefonnummer;
  71.  PUseVersion : TUseVersion;
  72.  
  73. implementation
  74.  
  75. {$R *.DFM}
  76.  
  77. procedure TForm1.Button1Click(Sender: TObject);
  78. var
  79.  EList : PDLLEintrag;
  80.  ETemp : PDLLArray;
  81.  ECount : LongInt;
  82.  co : LongInt;
  83. begin
  84.   PSucheTelefonnummer( PChar( Edit1.Text ), EList, ECount );
  85.   ETemp := PDLLArray( EList );
  86.  
  87.   for co := 1 to ECount do begin
  88.    ListBox1.Items.Add( ETemp^[co].Name + #32 + ETemp^[co].Vorname + #32 +
  89.                        ETemp^[co].Vorwahl + '-' + ETemp^[co].Telefon );
  90.   end;
  91. end;
  92.  
  93. procedure TForm1.RadioButton2Click(Sender: TObject);
  94. begin
  95.   PUseVersion( 2 );
  96. end;
  97.  
  98. procedure TForm1.RadioButton1Click(Sender: TObject);
  99. begin
  100.   PUseVersion( 1 );
  101. end;
  102.  
  103. initialization
  104.   DllHdl := 0;
  105.   FuncPtr := Nil;
  106.  
  107.   DllHdl := LoadLibrary( 'rufid.dll' );
  108.   if DllHdl = 0 then
  109.    Halt;
  110.  
  111.   FuncPtr := GetProcAddress( DllHdl, 'SucheTelefonnummer' );
  112.   if FuncPtr = nil then
  113.     Halt
  114.   else
  115.    @PSucheTelefonnummer := FuncPtr;
  116.  
  117.   FuncPtr := GetProcAddress( DllHdl, 'UseVersion' );
  118.   if FuncPtr = nil then
  119.     Halt
  120.   else
  121.    @PUseVersion := FuncPtr;
  122.  
  123. end.
Advertisement
Add Comment
Please, Sign In to add comment