Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converter código em Delphi
Message
From
30/01/2004 18:54:04
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Third party products
Title:
Converter código em Delphi
Miscellaneous
Thread ID:
00872585
Message ID:
00872585
Views:
70
Pessoal,

Preciso alterar as configurações do BDE - Borland DataBase Engine(Adicionar alias, alterar MaxFileHedle...) por código VFP.

Como posso fazer isso?...

No help do BDE tem exemplos, mas os exemplos estão em Delphi e não trabalhamos mais com Delphi.
Como converter a procedure abaixo, escrita em Delphi, pra VFP8?... Quando o Delphi fala "uses BDE" como devemos falar no VFP?...


unit BDEProg1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, BDE;

type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);

var
hDB: hDBIDb; // Database handle
hCur: hDBICur; // Handle to the data cursor
szTableName: array [0..DBIMAXNAMELEN] of Char; // Table name
CursorProps: CURProps; // Data cursor properties
RecordBuffer: pBYTE; // Buffer into which to load a record
Company: array [0..30] of Char; // Variable for Company field
IsBlank: BOOL; // Variable for blank fields
begin
Check(DbiInit(nil));
Check(DbiOpenDatabase(nil, nil, dbiREADONLY, dbiOPENSHARED, nil, 0, nil
, nil, hDB));

Check(DbiSetDirectory(hDB, 'd:\Program Files\Borland\Borland Shared\Data'));
Check(DbiSetPrivateDir('c:\Temp'));
szTableName := 'Customer';
Check(DbiOpenTable(hDB, szTableName, szPARADOX, nil, nil, 0, dbiREADONLY, dbiOPENSHARED, xltFIELD, False, nil, hCur));
Check(DbiGetCursorProps(hCur, CursorProps));
RecordBuffer := AllocMem(CursorProps.iRecBufSize * SizeOf(BYTE));
Check(DbiSetToBegin(hCur));
Check(DbiGetNextRecord(hCur, dbiNOLOCK, RecordBuffer, nil));

Check(DbiGetField(hCur, 2, RecordBuffer, pBYTE(@Company), IsBlank));
FreeMem(RecordBuffer);
if not (hCur = nil) then Check(DbiCloseCursor(hCur));
if not (hDB = nil) then Check(DbiCloseDatabase(hDB));
Check(DbiExit);
Label1.Caption := StrPas(Company);
end;

end.

Next
Reply
Map
View

Click here to load this message in the networking platform