Hallo,
meine Testdll sieht nun so aus:
Hauptunit:
<pre>
library ymcpc;
{ Wichtiger Hinweis zur DLL-Speicherverwaltung: ShareMem muß sich in der
ersten Unit der unit-Klausel der Bibliothek und des Projekts befinden (Projekt-
Quelltext anzeigen), falls die DLL Prozeduren oder Funktionen exportiert, die
Strings als Parameter oder Funktionsergebnisse weitergibt. Dies trifft auf alle
Strings zu, die von oder zur DLL weitergegeben werden -- auch diejenigen, die
sich in Records oder Klassen befinden. ShareMem ist die Schnittstellen-Unit
zu BORLNDMM.DLL, der gemeinsamen Speicherverwaltung, die zusammen mit
der DLL weitergegeben werden muß. Um die Verwendung von BORLNDMM.DLL
zu vermeiden, sollten String-Informationen als PChar oder ShortString übergeben werden. }
uses
ShareMem,
SysUtils,
Classes,
ComObj,
ActiveX,
UntObj in 'UntObj.pas';
{$R *.RES}
//stdcall ist eine Aufrufkonvention die besagt, wie Parameter übergeben werden.
function GetPartInfo (Partno : PChar) : TPartInfoRec; stdcall;
var
VPartinfo : TPartInfoRec;
begin
VPartinfo.ErrorCode := 0;
VPartinfo.DealerPrice1 := 25.00;
VPartinfo.DealerPrice2 := 50.00;
VPartinfo.RetailPrice1 := 25.00;
VPartinfo.RetailPrice2 := 50.00;
VPartinfo.TaxRate := 2.0;
VPartinfo.ErrorCode := 0;
result := VPartinfo;
end;
exports
GetPartInfo;
begin
end.
</pre>
zweiter unit:
<pre>
unit UntObj;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComObj, ActiveX;
//als Objekt
Type
TPartInfo = class(TObject)
private
OnHand : double; //Stock quantity at the store
DealerPrice1 : double; //Dealer price(without TAX)
DealerPrice2 : double; //Dealer price(with TAX)
RetailPrice1 : double; // Suggest retail price(without TAX)
RetailPrice2 : double; //Suggest retail price(with TAX)
TaxRate : double; //Tax Rate
StockLocation : PChar; //Location No. for stock
Description : PChar; //Part name (in local language)
Supersession : PChar; //Supersession part No.(with hyphen )
FinalSupersession : PChar; //Final Supersession part No.(with hyphen )
CurrencyUnit : PChar; //3 digits currency code( ISO standard)
Item2 : PChar; //Reserve field 2
Item3 : PChar; //Reserve field 3
Item5 : PChar; //Reserve field 5
ErrorCode : integer; (*
Error Code:0: Normal termination -1:
Arguments error-2:
The part No is not available in the DMS master.
-100: error of the application program
*)
ErrorMessage : PChar; //Error message generated through ActiveX
public
procedure SetOnHand(Stock: double);
function GetOnHand: double;
procedure SetDealerPrice1(VDealerPrice1: double);
function GetDealerPrice1: double;
procedure SetDealerPrice2(VDealerPrice2: double);
function GetDealerPrice2: double;
procedure SetRetailPrice1(VRetailPrice1: double);
function GetRetailPrice1: double;
procedure SetRetailPrice2(VRetailPrice2: double);
function GetRetailPrice2: double;
procedure SetTaxRate(VTaxRate: double);
function GetTaxRate: double;
procedure SetStockLocation(VStockLocation: PChar);
function GetStockLocation: PChar;
procedure SetDescription(VDescription: PChar);
function GetDescription: PChar;
procedure SetErrorCode(VErrorCode: Integer);
function GetErrorCode: Integer;
end;
//Als Record
Type
TPartInfoRec = record
OnHand : double; //Stock quantity at the store
DealerPrice1 : double; //Dealer price(without TAX)
DealerPrice2 : double; //Dealer price(with TAX)
RetailPrice1 : double; // Suggest retail price(without TAX)
RetailPrice2 : double; //Suggest retail price(with TAX)
TaxRate : double; //Tax Rate
StockLocation : PChar; //Location No. for stock
Description : PChar; //Part name (in local language)
Supersession : PChar; //Supersession part No.(with hyphen )
FinalSupersession : PChar; //Final Supersession part No.(with hyphen )
CurrencyUnit : PChar; //3 digits currency code( ISO standard)
Item2 : PChar; //Reserve field 2
Item3 : PChar; //Reserve field 3
Item5 : PChar; //Reserve field 5
ErrorCode : integer; (*
Error Code:0: Normal termination -1:
Arguments error-2:
The part No is not available in the DMS master.
-100: error of the application program
*)
ErrorMessage : PChar; //Error message generated through ActiveX
end;
implementation
procedure TPartInfo.SetOnHand(Stock: double);
begin
OnHand := Stock;
end;
function TPartInfo.GetOnHand: double;
begin
result := OnHand;
end;
procedure TPartInfo.SetDealerPrice1(VDealerPrice1: double);
begin
DealerPrice1 := VDealerPrice1;
end;
function TPartInfo.GetDealerPrice1: double;
begin
result := DealerPrice1;
end;
procedure TPartInfo.SetDealerPrice2(VDealerPrice2: double);
begin
DealerPrice2 := VDealerPrice2;
end;
function TPartInfo.GetDealerPrice2: double;
begin
result := DealerPrice2;
end;
procedure TPartInfo.SetRetailPrice1(VRetailPrice1: double);
begin
RetailPrice1 := VRetailPrice1;
end;
function TPartInfo.GetRetailPrice1: double;
begin
result := RetailPrice1;
end;
procedure TPartInfo.SetRetailPrice2(VRetailPrice2: double);
begin
RetailPrice2 := VRetailPrice2;
end;
function TPartInfo.GetRetailPrice2: double;
begin
result := RetailPrice2;
end;
procedure TPartInfo.SetTaxRate(VTaxRate: double);
begin
TaxRate := VTaxRate;
end;
function TPartInfo.GetTaxRate: double;
begin
result := TaxRate;
end;
procedure TPartInfo.SetStockLocation(VStockLocation: PChar);
begin
StockLocation := VStockLocation;
end;
function TPartInfo.GetStockLocation: PChar;
begin
result := StockLocation;
end;
procedure TPartInfo.SetDescription(VDescription: PChar);
begin
Description := VDescription;
end;
function TPartInfo.GetDescription: PChar;
begin
result := Description;
end;
procedure TPartInfo.SetErrorCode(VErrorCode: Integer);
begin
ErrorCode := VErrorCode;
end;
function TPartInfo.GetErrorCode: Integer;
begin
Result := ErrorCode;
end;
end.
</pre>
jetzt habe ich versucht diese dll zu regstrieren und bekomme folgende fehlermeldung:
<b>
ymcpc.dll was loadet, but ther dllregisterserver entrypoint was not found. dllregisterserver may not be exported, or a corrupt version of ymcpc.dll may be in memory. consider using PView to detect and remove it.
</b>
was bedeutet das?
Gruß
Markus
meine Testdll sieht nun so aus:
Hauptunit:
<pre>
library ymcpc;
{ Wichtiger Hinweis zur DLL-Speicherverwaltung: ShareMem muß sich in der
ersten Unit der unit-Klausel der Bibliothek und des Projekts befinden (Projekt-
Quelltext anzeigen), falls die DLL Prozeduren oder Funktionen exportiert, die
Strings als Parameter oder Funktionsergebnisse weitergibt. Dies trifft auf alle
Strings zu, die von oder zur DLL weitergegeben werden -- auch diejenigen, die
sich in Records oder Klassen befinden. ShareMem ist die Schnittstellen-Unit
zu BORLNDMM.DLL, der gemeinsamen Speicherverwaltung, die zusammen mit
der DLL weitergegeben werden muß. Um die Verwendung von BORLNDMM.DLL
zu vermeiden, sollten String-Informationen als PChar oder ShortString übergeben werden. }
uses
ShareMem,
SysUtils,
Classes,
ComObj,
ActiveX,
UntObj in 'UntObj.pas';
{$R *.RES}
//stdcall ist eine Aufrufkonvention die besagt, wie Parameter übergeben werden.
function GetPartInfo (Partno : PChar) : TPartInfoRec; stdcall;
var
VPartinfo : TPartInfoRec;
begin
VPartinfo.ErrorCode := 0;
VPartinfo.DealerPrice1 := 25.00;
VPartinfo.DealerPrice2 := 50.00;
VPartinfo.RetailPrice1 := 25.00;
VPartinfo.RetailPrice2 := 50.00;
VPartinfo.TaxRate := 2.0;
VPartinfo.ErrorCode := 0;
result := VPartinfo;
end;
exports
GetPartInfo;
begin
end.
</pre>
zweiter unit:
<pre>
unit UntObj;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComObj, ActiveX;
//als Objekt
Type
TPartInfo = class(TObject)
private
OnHand : double; //Stock quantity at the store
DealerPrice1 : double; //Dealer price(without TAX)
DealerPrice2 : double; //Dealer price(with TAX)
RetailPrice1 : double; // Suggest retail price(without TAX)
RetailPrice2 : double; //Suggest retail price(with TAX)
TaxRate : double; //Tax Rate
StockLocation : PChar; //Location No. for stock
Description : PChar; //Part name (in local language)
Supersession : PChar; //Supersession part No.(with hyphen )
FinalSupersession : PChar; //Final Supersession part No.(with hyphen )
CurrencyUnit : PChar; //3 digits currency code( ISO standard)
Item2 : PChar; //Reserve field 2
Item3 : PChar; //Reserve field 3
Item5 : PChar; //Reserve field 5
ErrorCode : integer; (*
Error Code:0: Normal termination -1:
Arguments error-2:
The part No is not available in the DMS master.
-100: error of the application program
*)
ErrorMessage : PChar; //Error message generated through ActiveX
public
procedure SetOnHand(Stock: double);
function GetOnHand: double;
procedure SetDealerPrice1(VDealerPrice1: double);
function GetDealerPrice1: double;
procedure SetDealerPrice2(VDealerPrice2: double);
function GetDealerPrice2: double;
procedure SetRetailPrice1(VRetailPrice1: double);
function GetRetailPrice1: double;
procedure SetRetailPrice2(VRetailPrice2: double);
function GetRetailPrice2: double;
procedure SetTaxRate(VTaxRate: double);
function GetTaxRate: double;
procedure SetStockLocation(VStockLocation: PChar);
function GetStockLocation: PChar;
procedure SetDescription(VDescription: PChar);
function GetDescription: PChar;
procedure SetErrorCode(VErrorCode: Integer);
function GetErrorCode: Integer;
end;
//Als Record
Type
TPartInfoRec = record
OnHand : double; //Stock quantity at the store
DealerPrice1 : double; //Dealer price(without TAX)
DealerPrice2 : double; //Dealer price(with TAX)
RetailPrice1 : double; // Suggest retail price(without TAX)
RetailPrice2 : double; //Suggest retail price(with TAX)
TaxRate : double; //Tax Rate
StockLocation : PChar; //Location No. for stock
Description : PChar; //Part name (in local language)
Supersession : PChar; //Supersession part No.(with hyphen )
FinalSupersession : PChar; //Final Supersession part No.(with hyphen )
CurrencyUnit : PChar; //3 digits currency code( ISO standard)
Item2 : PChar; //Reserve field 2
Item3 : PChar; //Reserve field 3
Item5 : PChar; //Reserve field 5
ErrorCode : integer; (*
Error Code:0: Normal termination -1:
Arguments error-2:
The part No is not available in the DMS master.
-100: error of the application program
*)
ErrorMessage : PChar; //Error message generated through ActiveX
end;
implementation
procedure TPartInfo.SetOnHand(Stock: double);
begin
OnHand := Stock;
end;
function TPartInfo.GetOnHand: double;
begin
result := OnHand;
end;
procedure TPartInfo.SetDealerPrice1(VDealerPrice1: double);
begin
DealerPrice1 := VDealerPrice1;
end;
function TPartInfo.GetDealerPrice1: double;
begin
result := DealerPrice1;
end;
procedure TPartInfo.SetDealerPrice2(VDealerPrice2: double);
begin
DealerPrice2 := VDealerPrice2;
end;
function TPartInfo.GetDealerPrice2: double;
begin
result := DealerPrice2;
end;
procedure TPartInfo.SetRetailPrice1(VRetailPrice1: double);
begin
RetailPrice1 := VRetailPrice1;
end;
function TPartInfo.GetRetailPrice1: double;
begin
result := RetailPrice1;
end;
procedure TPartInfo.SetRetailPrice2(VRetailPrice2: double);
begin
RetailPrice2 := VRetailPrice2;
end;
function TPartInfo.GetRetailPrice2: double;
begin
result := RetailPrice2;
end;
procedure TPartInfo.SetTaxRate(VTaxRate: double);
begin
TaxRate := VTaxRate;
end;
function TPartInfo.GetTaxRate: double;
begin
result := TaxRate;
end;
procedure TPartInfo.SetStockLocation(VStockLocation: PChar);
begin
StockLocation := VStockLocation;
end;
function TPartInfo.GetStockLocation: PChar;
begin
result := StockLocation;
end;
procedure TPartInfo.SetDescription(VDescription: PChar);
begin
Description := VDescription;
end;
function TPartInfo.GetDescription: PChar;
begin
result := Description;
end;
procedure TPartInfo.SetErrorCode(VErrorCode: Integer);
begin
ErrorCode := VErrorCode;
end;
function TPartInfo.GetErrorCode: Integer;
begin
Result := ErrorCode;
end;
end.
</pre>
jetzt habe ich versucht diese dll zu regstrieren und bekomme folgende fehlermeldung:
<b>
ymcpc.dll was loadet, but ther dllregisterserver entrypoint was not found. dllregisterserver may not be exported, or a corrupt version of ymcpc.dll may be in memory. consider using PView to detect and remove it.
</b>
was bedeutet das?
Gruß
Markus
Comment