Registriert seit: 28. Jan 2006
Ort: Görlitz / Sachsen
489 Beiträge
Delphi 2007 Professional
|
Re: Personalausweisnummer generieren
24. Jul 2007, 18:49
Üblicherweise sehen Projekte mit mehr als 1 Button und 2 Edits bei mir so aus
Delphi-Quellcode:
procedure TFormMain.btnCalcClick(Sender: TObject);
var
sie:Integer;
begin
editPhonetyp.Visible:=false;
btnReport.Visible:=false;
memo1.clear;
sie:=strtoint(Copy(editIMEI.Text,1,2));
if ed = false then begin
Memo1.Lines.add('Insert IMEI first');
editIMEI.SetFocus;
exit;
end;
if Length(editIMEI.Text) < 17 then begin
Memo1.Lines.add('Insert IMEI first');
editIMEI.SetFocus;
exit;
end;
CalkImei15;
taco:=StrToInt(Copy(editIMEI.Text,1,6)+Copy(editIMEI.Text,8,2));
ADOQuery1.Close;
if sie < 35 then begin
ADOQuery1.SQL.Text := 'select * from Babt00';
Database;
end;
if sie = 35 then begin
ADOQuery1.SQL.Text := 'select * from Babt35';
Database;
end;
if sie >= 36 then begin
ADOQuery1.SQL.Text := 'select * from Babt36';
Database;
end;
end;
procedure TFormMain.Timer1Timer(Sender: TObject);
begin
AlphaBlendValue := AlphaBlendValue + 3;
Timer1.Enabled := AlphaBlendValue < 255;
if AlphaBlendValue = 255 then editIMEI.SetFocus;
end;
procedure TFormMain.Database;
begin
ADOQuery1.Open;
While Not ADOQuery1.Eof do
begin
if ADOQuery1.FieldByName('Feld1').asinteger =(Taco) then
begin
hst:= ADOQuery1.FieldValues['Feld2'];
modell:=ADOQuery1.FieldValues['Feld3'];
zula:=ADOQuery1.FieldValues['Feld4'];
land:=ADOQuery1.FieldValues['Feld5'];
end;
ADOQuery1.Next;
end;
if i15=y then begin
lblCheck.Font.Color := clgreen;
lblCheck.Caption := 'Valid';
btnCorrect.enabled := False;
end else
if i15<>y then begin
lblCheck.Font.Color :=clred;
lblCheck.Caption := 'Invalid';
btnCorrect.enabled := True;
end;
if Length(hst) =0 then begin
memo1.clear;
memo1.Lines.add('Phone not found. Please Report your TAC ');
memo1.Lines.add('and your Phonemodel ');
editPhonetyp.Visible:=true;
btnReport.Visible:=true;
editPhonetyp.SetFocus;
exit;
end else
memo1.Lines.add('IMEI : '+editIMEI.Text+' is '+lblCheck.Caption);
memo1.Lines.add('Manufacturer :'+hst);
memo1.Lines.add('Model :'+modell);
memo1.Lines.add('Reg. :'+zula);
memo1.Lines.add('Country :'+land);
editIMEI.SetFocus;
end;
function TFormMain.GetEnv(Variable:string):string;
var buffer:array[1..1024] of char;
begin
if GetEnvironmentVariable( pChar(variable) , @Buffer, Sizeof(buffer) )=0 then
result:=''
else
result:=PathGetLongName(buffer);
end;
function TFormMain.PathGetLongName(const ShortPath: String): String;
var
GetLongPathName: TGetLongPathName;
hKernel32: THandle;
begin
hKernel32 := LoadLibrary(kernel32);
try
GetLongPathName := GetProcAddress(hKernel32, 'GetLongPathNameA');
if not Assigned(GetLongPathName) then RaiseLastWin32Error; //RaiseLastOSError NT / RaiseLastWin32Error 9X
SetLength(Result, GetLongPathName(PChar(ShortPath), nil, 0));
SetLength(Result, GetLongPathName(PChar(ShortPath), PChar(Result),
Length(Result)));
finally
FreeLibrary(hKernel32);
end; {end try/finally}
end;
Marcel
|
|
Zitat
|