Delphi XE4 и trans2quik.dll

Страницы: 1
RSS
Delphi XE4 и trans2quik.dll
 
Добрый день!

Загружаю trans2quik.dll динамически
unit tr2quik;

interface

uses
 WinApi.Windows, System.Sysutils;

const
 DllName = 'TRANS2QUIK.DLL';
//-------------- Constants --------------------------
 TRANS2QUIK_SUCCESS                   = 0;
 TRANS2QUIK_FAILED                    = 1;
 TRANS2QUIK_QUIK_TERMINAL_NOT_FOUND   = 2;
 TRANS2QUIK_DLL_VERSION_NOT_SUPPORTED = 3;
 TRANS2QUIK_ALREADY_CONNECTED_TO_QUIK = 4;
 TRANS2QUIK_WRONG_SYNTAX              = 5;
 TRANS2QUIK_QUIK_NOT_CONNECTED        = 6;
 TRANS2QUIK_DLL_NOT_CONNECTED         = 7;
 TRANS2QUIK_QUIK_CONNECTED            = 8;
 TRANS2QUIK_QUIK_DISCONNECTED         = 9;
 TRANS2QUIK_DLL_CONNECTED             = 10;
 TRANS2QUIK_DLL_DISCONNECTED          = 11;
 TRANS2QUIK_MEMORY_ALLOCATION_ERROR   = 12;
 TRANS2QUIK_WRONG_CONNECTION_HANDLE   = 13;
 TRANS2QUIK_WRONG_INPUT_PARAMS        = 14;

 ORDER_QUIKDATE          = 0;
 ORDER_QUIKTIME          = 1;
 ORDER_MICROSEC          = 2;
 ORDER_WITHDRAW_QUIKDATE = 3;
 ORDER_WITHDRAW_QUIKTIME = 4;
 ORDER_WITHDRAW_MICROSEC = 5;

 TRADE_QUIKDATE = 0;
 TRADE_QUIKTIME = 1;
 TRADE_MICROSEC = 2;

//-------- Load library function -------
 function LibLoad(const aPath: string): THandle;

 //------------------------- Types ------------------------------
type
 intptr_t = NativeInt;
 Quantity = int64;
 EntityNumber = uint64;
 PEntityNumber = ^EntityNumber;
 OrderDescr = intptr_t;
 TradeDescr = intptr_t;
 TransReplyDescr = intptr_t;

//----------------------- CallBack procedures ------------------
 TRANS2QUIK_CONNECTION_STATUS_CALLBACK = procedure(nConnectionEvent: long;
                                     var nExtendedErrorCode: long;
                                       var lpcstrInfoMessage: LPCSTR); stdcall;

 TRANS2QUIK_TRANSACTION_REPLY_CALLBACK = procedure(var nTransactionResult: long;
                                     var nTransactionExtendedErrorCode: long;
                                     var nTransactionReplyCode: long;
                                     var dwTransId: DWord;
                                       nOrderNum: EntityNumber;
                                     var lpcstrTransactionReplyMessage: LPCSTR;
                                     var transReplyDescriptor: TransReplyDescr); stdcall;

 TRANS2QUIK_ORDER_STATUS_CALLBACK = procedure( nMode: long;
                                   dwTransID: DWORD;
                                 dNumber: EntityNumber;
                                 ClassCode: LPCSTR;
                                 SecCode: LPCSTR;
                                 dPrice: double;
                                 nBalance: Quantity;
                                 dValue: double;
                                 nIsSell: long;
                                 nStatus: long;
                                 orderDescriptor: OrderDescr); stdcall;

 TRANS2QUIK_TRADE_STATUS_CALLBACK = procedure( nMode: long;
                                 dNumber: EntityNumber;
                                 dOrderNumber: EntityNumber;
                                 ClassCode: LPCSTR;
                                 SecCode: LPCSTR;
                                 dPrice: double;
                                 nQty: Quantity;
                                 dValue: double;
                                 nIsSell: long;
                                 tradeDescriptor: TradeDescr); stdcall;
//------------ Functions -------------------
 TRANS2QUIK_SEND_SYNC_TRANSACTION = function(lpstTransactionString: LPSTR;
                                             var pnReplyCode: long;
                                              pdwTransId: PDWORD;
                                              var pnOrderNum:EntityNumber;
                                              lpstrResultMessage: LPSTR;
                                              dwResultMessageSize: DWORD;
                                              var pnExtendedErrorCode: long;
                                              lpstErrorMessage: LPSTR;
                                              dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_SEND_ASYNC_TRANSACTION = function(lpstTransactionString: LPSTR;
                                              var pnExtendedErrorCode: long;
                                              var lpstErrorMessage: LPSTR;
                                              var dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_CONNECT = function(lpstConnectionParamsString: LPSTR;
                               var pnExtendedErrorCode: long;
                               var lpstrErrorMessage: LPSTR;
                               var dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_DISCONNECT = function(var pnExtendedErrorCode: long;
                                  lpstrErrorMessage: LPSTR;
                                  dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_SET_CONNECTION_STATUS_CALLBACK = function(pfConnectionStatusCallback: TRANS2QUIK_CONNECTION_STATUS_CALLBACK;
                                                      var pnExtendedErrorCode: long;
                                                      lpstrErrorMessage: LPSTR;
                                                      dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_SET_TRANSACTIONS_REPLY_CALLBACK = function(pfTransactionReplyCallback: TRANS2QUIK_TRANSACTION_REPLY_CALLBACK;
                                                       var pnExtendedErrorCode: long;
                                                       lpstrErrorMessage: LPSTR;
                                                       dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_IS_QUIK_CONNECTED = function(var pnExtendedErrorCode: long;
                                         lpstrErrorMessage: LPSTR;
                                         dwErrorMessageSize: Dword): long; stdcall;
 TRANS2QUIK_IS_DLL_CONNECTED = function(var pnExtendedErrorCode: long;
                                        lpstrErrorMessage: LPSTR;
                                        dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_SUBSCRIBE_ORDERS = function(ClassCode: LPSTR;
                                        Seccodes: LPSTR): long; stdcall;
 TRANS2QUIK_UNSUBSCRIBE_ORDERS = function(): long; stdcall;
 TRANS2QUIK_START_ORDERS = function(pfnOrderStatusCallback: TRANS2QUIK_ORDER_STATUS_CALLBACK): long; stdcall;
 TRANS2QUIK_ORDER_QTY = function(orderDescriptor: OrderDescr): Quantity; stdcall;
 TRANS2QUIK_ORDER_DATE = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_TIME = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_ACTIVATION_TIME = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_WITHDRAW_TIME = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_EXPIRY = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_ACCRUED_INT = function(orderDescriptor: OrderDescr): Double; stdcall;
 TRANS2QUIK_ORDER_YIELD = function(orderDescriptor: OrderDescr): double; stdcall;
 TRANS2QUIK_ORDER_UID = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_VISIBLE_QTY = function(orderDescriptor: OrderDescr): Quantity; stdcall;
 TRANS2QUIK_ORDER_PERIOD = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_FILETIME = function(orderDescriptor: OrderDescr): FILETIME; stdcall;
 TRANS2QUIK_ORDER_DATE_TIME = function(orderDescriptor: OrderDescr; nTimeType: long): long; stdcall;
 TRANS2QUIK_ORDER_WITHDRAW_FILETIME = function(orderDescriptor: OrderDescr): FILETIME; stdcall;
 TRANS2QUIK_ORDER_VALUE_ENTRY_TYPE = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_EXTENDED_FLAGS = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_MIN_QTY = function(orderDescriptor: OrderDescr): Quantity; stdcall;
 TRANS2QUIK_ORDER_EXEC_TYPE = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_AWG_PRICE = function(orderDescriptor: OrderDescr): double; stdcall;
 TRANS2QUIK_ORDER_USERID = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
 TRANS2QUIK_ORDER_ACCOUNT = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
 TRANS2QUIK_ORDER_BROKERREF = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
 TRANS2QUIK_ORDER_CLIENT_CODE = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
 TRANS2QUIK_ORDER_FIRMID = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
 TRANS2QUIK_ORDER_REJECT_REASON = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
 TRANS2QUIK_SUBSCRIBE_TRADES = function(ClassCode: LPSTR; Seccodes: LPSTR): long; stdcall;
 TRANS2QUIK_UNSUBSCRIBE_TRADES = function(): long;  stdcall;
 TRANS2QUIK_START_TRADES = function(pfnTradeStatusCallback: TRANS2QUIK_TRADE_STATUS_CALLBACK): long; stdcall;
 TRANS2QUIK_TRADE_DATE = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_SETTLE_DATE = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_TIME = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_IS_MARGINAL = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_ACCRUED_INT = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_YIELD = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_TS_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_CLEARING_CENTER_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_EXCHANGE_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_TRADING_SYSTEM_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_PRICE2 = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_REPO_RATE = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_REPO_VALUE = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_REPO2_VALUE = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_ACCRUED_INT2 = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_REPO_TERM = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_START_DISCOUNT = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_LOWER_DISCOUNT = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_UPPER_DISCOUNT = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_BLOCK_SECURITIES = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_PERIOD = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_KIND = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_FILETIME = function(tradeDescriptor: TradeDescr): FILETIME; stdcall;
 TRANS2QUIK_TRADE_DATE_TIME = function(tradeDescriptor: TradeDescr; nTimeType: long): long; stdcall;
 TRANS2QUIK_TRADE_BROKER_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_TRANSID = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_CURRENCY = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_SETTLE_CURRENCY = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_SETTLE_CODE = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_ACCOUNT = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_BROKERREF = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_CLIENT_CODE = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_USERID = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_FIRMID = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_PARTNER_FIRMID = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_EXCHANGE_CODE = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_STATION_ID = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_CLASS_CODE = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_SEC_CODE = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_PRICE = function(tradeDescriptor: TransReplyDescr): double; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_QUANTITY = function(tradeDescriptor: TransReplyDescr): Quantity; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_BALANCE = function(tradeDescriptor: TransReplyDescr): Quantity; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_FIRMID = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_ACCOUNT = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_CLIENT_CODE = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_BROKERREF = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_EXCHANGE_CODE = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;

var
 T2QConnStatCallBack: TRANS2QUIK_CONNECTION_STATUS_CALLBACK;
 T2QTransReplyCallBack:  TRANS2QUIK_TRANSACTION_REPLY_CALLBACK;
 T2QOrderStatCallBack: TRANS2QUIK_ORDER_STATUS_CALLBACK;
 T2QTradeStatCallBack: TRANS2QUIK_TRADE_STATUS_CALLBACK;
 T2QSendSyncTrans: TRANS2QUIK_SEND_SYNC_TRANSACTION;
 T2QSendASyncTrans: TRANS2QUIK_SEND_ASYNC_TRANSACTION;
 T2QConnect: TRANS2QUIK_CONNECT;
 T2QDisconnect: TRANS2QUIK_DISCONNECT;
 T2QSetConnStatCallBAck: TRANS2QUIK_SET_CONNECTION_STATUS_CALLBACK;
 T2QSetTransReplyCallBAck: TRANS2QUIK_SET_TRANSACTIONS_REPLY_CALLBACK;
 T2QIsQuikConnected: TRANS2QUIK_IS_QUIK_CONNECTED;
 T2QIsDllConnected: TRANS2QUIK_IS_DLL_CONNECTED;
 T2QSubscribeOrders: TRANS2QUIK_SUBSCRIBE_ORDERS;
 T2QUnSubscribeOrders: TRANS2QUIK_UNSUBSCRIBE_ORDERS;
 T2QStartOrders: TRANS2QUIK_START_ORDERS;
 T2QOrderQty: TRANS2QUIK_ORDER_QTY;
 T2QOrderDate: TRANS2QUIK_ORDER_DATE;
 T2QOrderTime: TRANS2QUIK_ORDER_TIME;
 T2QOrderActiveTime: TRANS2QUIK_ORDER_ACTIVATION_TIME;
 T2QOrderWithdrawTime: TRANS2QUIK_ORDER_WITHDRAW_TIME;
 T2QOrderExpiry: TRANS2QUIK_ORDER_EXPIRY;
 T2QOrderAccruedInt: TRANS2QUIK_ORDER_ACCRUED_INT;
 T2QOrderYield: TRANS2QUIK_ORDER_YIELD;
 T2QOrderUid: TRANS2QUIK_ORDER_UID;
 T2QOrderVisibleQty: TRANS2QUIK_ORDER_VISIBLE_QTY;
 T2QOrderPeriod: TRANS2QUIK_ORDER_PERIOD;
 T2QOrderFileTime: TRANS2QUIK_ORDER_FILETIME;
 T2QOrderDateTime: TRANS2QUIK_ORDER_DATE_TIME;
 T2QOrderWithdrawFileTime: TRANS2QUIK_ORDER_WITHDRAW_FILETIME;
 T2QOrderValueEntryType: TRANS2QUIK_ORDER_VALUE_ENTRY_TYPE;
 T2QOrderExtdFlags: TRANS2QUIK_ORDER_EXTENDED_FLAGS;
 T2QOrderMinQty: TRANS2QUIK_ORDER_MIN_QTY;
 T2QOrderExecType: TRANS2QUIK_ORDER_EXEC_TYPE;
 T2QOrderAwgPrice: TRANS2QUIK_ORDER_AWG_PRICE;
 T2QOrderUserId: TRANS2QUIK_ORDER_USERID;
 T2QOrderAccaunt: TRANS2QUIK_ORDER_ACCOUNT;
 T2QOrderBrokerRef: TRANS2QUIK_ORDER_BROKERREF;
 T2QOrderClientCode: TRANS2QUIK_ORDER_CLIENT_CODE;
 T2QOrderFirmId: TRANS2QUIK_ORDER_FIRMID;
 T2QOrderRejectReason: TRANS2QUIK_ORDER_REJECT_REASON;
 T2QSubscribeTrades: TRANS2QUIK_SUBSCRIBE_TRADES;
 T2QUnSubscribeTrades: TRANS2QUIK_UNSUBSCRIBE_TRADES;
 T2QStartTrades: TRANS2QUIK_START_TRADES;
 T2QTradeDate: TRANS2QUIK_TRADE_DATE;
 T2QTradeSettleDate: TRANS2QUIK_TRADE_SETTLE_DATE;
 T2QTradeTime: TRANS2QUIK_TRADE_TIME;
 T2QTradeIsMarginal: TRANS2QUIK_TRADE_IS_MARGINAL;
 T2QTradeAccruedInt: TRANS2QUIK_TRADE_ACCRUED_INT;
 T2QTradeYield: TRANS2QUIK_TRADE_YIELD;
 T2QTradeTSCommission: TRANS2QUIK_TRADE_TS_COMMISSION;
 T2QTradeClCenterCommission: TRANS2QUIK_TRADE_CLEARING_CENTER_COMMISSION;
 T2QTradeExcCommission: TRANS2QUIK_TRADE_EXCHANGE_COMMISSION;
 T2QTradeTrSysCommission: TRANS2QUIK_TRADE_TRADING_SYSTEM_COMMISSION;
 T2QTradePrice2: TRANS2QUIK_TRADE_PRICE2;
 T2QTradeRepoRate: TRANS2QUIK_TRADE_REPO_RATE;
 T2QTradeRepoValue: TRANS2QUIK_TRADE_REPO_VALUE;
 T2QTradeRepo2Value: TRANS2QUIK_TRADE_REPO2_VALUE;
 T2QTradeAccruedInt2: TRANS2QUIK_TRADE_ACCRUED_INT2;
 T2QTradeRepoTerm: TRANS2QUIK_TRADE_REPO_TERM;
 T2QTradeStDiscount: TRANS2QUIK_TRADE_START_DISCOUNT;
 T2QTradeLwDiscount: TRANS2QUIK_TRADE_LOWER_DISCOUNT;
 T2QTradeUpDiscount: TRANS2QUIK_TRADE_UPPER_DISCOUNT;
 T2QTradeBlSecur: TRANS2QUIK_TRADE_BLOCK_SECURITIES;
 T2QTradePeriod: TRANS2QUIK_TRADE_PERIOD;
 T2QTradeKind: TRANS2QUIK_TRADE_KIND;
 T2QTradeFileName: TRANS2QUIK_TRADE_FILETIME;
 T2QTradeDateTime: TRANS2QUIK_TRADE_DATE_TIME;
 T2QTradeBrCommission: TRANS2QUIK_TRADE_BROKER_COMMISSION;
 T2QTradeTransId: TRANS2QUIK_TRADE_TRANSID;
 T2QTradeCurrensy: TRANS2QUIK_TRADE_CURRENCY;
 T2QTradeSettlCurr: TRANS2QUIK_TRADE_SETTLE_CURRENCY;
 T2QTradeSettlCode: TRANS2QUIK_TRADE_SETTLE_CODE;
 T2QTradeAccount: TRANS2QUIK_TRADE_ACCOUNT;
 T2QTradeBrRef: TRANS2QUIK_TRADE_BROKERREF;
 T2QTradeClCode: TRANS2QUIK_TRADE_CLIENT_CODE;
 T2QTradeUserId: TRANS2QUIK_TRADE_USERID;
 T2QTradeFirmId: TRANS2QUIK_TRADE_FIRMID;
 T2QTradePartFirmId: TRANS2QUIK_TRADE_PARTNER_FIRMID;
 T2QTradeExcCode: TRANS2QUIK_TRADE_EXCHANGE_CODE;
 T2QTradeStationId: TRANS2QUIK_TRADE_STATION_ID;
 T2QTransReplyClassCode: TRANS2QUIK_TRANSACTION_REPLY_CLASS_CODE;
 T2QTransReplySecCode: TRANS2QUIK_TRANSACTION_REPLY_SEC_CODE;
 T2QTransReplyPrice: TRANS2QUIK_TRANSACTION_REPLY_PRICE;
 T2QTransReplyQty: TRANS2QUIK_TRANSACTION_REPLY_QUANTITY;
 T2QTransReplyBal: TRANS2QUIK_TRANSACTION_REPLY_BALANCE;
 T2QTransReplyFirmId: TRANS2QUIK_TRANSACTION_REPLY_FIRMID;
 T2QTransReplyAccount: TRANS2QUIK_TRANSACTION_REPLY_ACCOUNT;
 T2QTransReplyClCode: TRANS2QUIK_TRANSACTION_REPLY_CLIENT_CODE;
 T2QTransReplyBrRef: TRANS2QUIK_TRANSACTION_REPLY_BROKERREF;
 T2QTransReplyExcCode: TRANS2QUIK_TRANSACTION_REPLY_EXCHANGE_CODE;

implementation


function LibLoad(const aPath: string): THandle;
begin
 Result:= LoadLibrary(PWideChar(IncludeTrailingPathDelimiter(aPath) + DllName));
 @T2QSendSyncTrans := GetProcAddress(Result, PWideChar('TRANS2QUIK_SEND_SYNC_TRANSACTION'));
 if(addr(T2QSendSyncTrans) = nil) then
 begin
    Result:= 0;
    Exit;
 end;
 @T2QSendASyncTrans := GetProcAddress(Result, PWideChar('TRANS2QUIK_SEND_ASYNC_TRANSACTION'));
 if(addr(T2QSendASyncTrans) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QConnect:= GetProcAddress(Result, PWideChar('TRANS2QUIK_CONNECT'));
 if(addr(T2QConnect) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QDisconnect := GetProcAddress(Result, PWideChar('TRANS2QUIK_DISCONNECT'));
 if(addr(T2QDisconnect) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QSetConnStatCallBAck := GetProcAddress(Result, PWideChar('TRANS2QUIK_SET_CONNECTION_STATUS_CALLBACK'));
 if(addr(T2QSetConnStatCallBAck) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QSetTransReplyCallBAck := GetProcAddress(Result, PWideChar('TRANS2QUIK_SET_TRANSACTIONS_REPLY_CALLBACK'));
 if(addr(T2QSetTransReplyCallBAck) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QIsQuikConnected := GetProcAddress(Result, PWideChar('TRANS2QUIK_IS_QUIK_CONNECTED'));
 if(addr(T2QIsQuikConnected) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QIsDllConnected := GetProcAddress(Result, PWideChar('TRANS2QUIK_IS_DLL_CONNECTED'));
 if(addr(T2QIsDllConnected) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QSubscribeOrders := GetProcAddress(Result, PWideChar('TRANS2QUIK_SUBSCRIBE_ORDERS'));
 if(addr(T2QSubscribeOrders) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QUnSubscribeOrders := GetProcAddress(Result, PWideChar('TRANS2QUIK_UNSUBSCRIBE_ORDERS'));
 if(addr(T2QUnSubscribeOrders) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QStartOrders := GetProcAddress(Result, PWideChar('TRANS2QUIK_START_ORDERS'));
 if(addr(T2QStartOrders) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_QTY'));
 if(addr(T2QOrderQty) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderDate := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_DATE'));
 if(addr(T2QOrderDate) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_TIME'));
 if(addr(T2QOrderTime) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderActiveTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_ACTIVATION_TIME'));
 if(addr(T2QOrderActiveTime) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderWithdrawTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_WITHDRAW_TIME'));
 if(addr(T2QOrderWithdrawTime) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderExpiry := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_EXPIRY'));
 if(addr(T2QOrderExpiry) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderAccruedInt := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_ACCRUED_INT'));
 if(addr(T2QOrderAccruedInt) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderYield := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_YIELD'));
 if(addr(T2QOrderYield) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderUid := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_UID'));
 if(addr(T2QOrderUid) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderVisibleQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_VISIBLE_QTY'));
 if(addr(T2QOrderVisibleQty) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderPeriod := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_PERIOD'));
 if(addr(T2QOrderPeriod) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderFileTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_FILETIME'));
 if(addr(T2QOrderFileTime) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderDateTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_DATE_TIME'));
 if(addr(T2QOrderDateTime) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderWithdrawFileTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_WITHDRAW_FILETIME'));
 if(addr(T2QOrderWithdrawFileTime) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderValueEntryType := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_VALUE_ENTRY_TYPE'));
 if(addr(T2QOrderValueEntryType) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderExtdFlags := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_EXTENDED_FLAGS'));
 if(addr(T2QOrderExtdFlags) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderMinQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_MIN_QTY'));
 if(addr(T2QOrderMinQty) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderExecType := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_EXEC_TYPE'));
 if(addr(T2QOrderExecType) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderAwgPrice := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_AWG_PRICE'));
 if(addr(T2QOrderAwgPrice) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderUserId := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_USERID'));
 if(addr(T2QOrderUserId) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderAccaunt := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_ACCOUNT'));
 if(addr(T2QOrderAccaunt) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderBrokerRef := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_BROKERREF'));
 if(addr(T2QOrderBrokerRef) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderClientCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_CLIENT_CODE'));
 if(addr(T2QOrderClientCode) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_FIRMID'));
 if(addr(T2QOrderFirmId) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QOrderRejectReason := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_REJECT_REASON'));
 if(addr(T2QOrderRejectReason) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QSubscribeTrades := GetProcAddress(Result, PWideChar('TRANS2QUIK_SUBSCRIBE_TRADES'));
 if(addr(T2QSubscribeTrades) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QUnSubscribeTrades := GetProcAddress(Result, PWideChar('TRANS2QUIK_UNSUBSCRIBE_TRADES'));
 if(addr(T2QUnSubscribeTrades) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QStartTrades := GetProcAddress(Result, PWideChar('TRANS2QUIK_START_TRADES'));
 if(addr(T2QStartTrades) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeDate := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_DATE'));
 if(addr(T2QTradeDate) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeSettleDate := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_SETTLE_DATE'));
 if(addr(T2QTradeSettleDate) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TIME'));
 if(addr(T2QTradeTime) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeIsMarginal := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_IS_MARGINAL'));
 if(addr(T2QTradeIsMarginal) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeAccruedInt := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_ACCRUED_INT'));
 if(addr(T2QTradeAccruedInt) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeYield := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_YIELD'));
 if(addr(T2QTradeYield) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeTSCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TS_COMMISSION'));
 if(addr(T2QTradeTSCommission) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeClCenterCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TS_COMMISSION'));
 if(addr(T2QTradeClCenterCommission) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeExcCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_EXCHANGE_COMMISSION'));
 if(addr(T2QTradeExcCommission) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeTrSysCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TRADING_SYSTEM_COMMISSION'));
 if(addr(T2QTradeTrSysCommission) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradePrice2 := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_PRICE2'));
 if(addr(T2QTradePrice2) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeRepoRate := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO_RATE'));
 if(addr(T2QTradeRepoRate) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeRepoValue := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO_VALUE'));
 if(addr(T2QTradeRepoValue) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeRepo2Value := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO2_VALUE'));
 if(addr(T2QTradeRepo2Value) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeAccruedInt2 := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_ACCRUED_INT2'));
 if(addr(T2QTradeAccruedInt2) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeRepoTerm := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO_TERM'));
 if(addr(T2QTradeRepoTerm) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeStDiscount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_START_DISCOUNT'));
 if(addr(T2QTradeStDiscount) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeLwDiscount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_LOWER_DISCOUNT'));
 if(addr(T2QTradeLwDiscount) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeUpDiscount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_UPPER_DISCOUNT'));
 if(addr(T2QTradeUpDiscount) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeBlSecur := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_UPPER_DISCOUNT'));
 if(addr(T2QTradeBlSecur) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradePeriod := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_PERIOD'));
 if(addr(T2QTradePeriod) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeKind := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_KIND'));
 if(addr(T2QTradeKind) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeFileName := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_FILETIME'));
 if(addr(T2QTradeFileName) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeDateTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_DATE_TIME'));
 if(addr(T2QTradeDateTime) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeBrCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_BROKER_COMMISSION'));
 if(addr(T2QTradeBrCommission) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeTransId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TRANSID'));
 if(addr(T2QTradeTransId) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeCurrensy := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_CURRENCY'));
 if(addr(T2QTradeCurrensy) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeSettlCurr := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_SETTLE_CURRENCY'));
 if(addr(T2QTradeSettlCurr) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeSettlCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_SETTLE_CODE'));
 if(addr(T2QTradeSettlCode) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeAccount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_ACCOUNT'));
 if(addr(T2QTradeAccount) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeBrRef := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_BROKERREF'));
 if(addr(T2QTradeBrRef) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeClCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_CLIENT_CODE'));
 if(addr(T2QTradeClCode) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeUserId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_USERID'));
 if(addr(T2QTradeUserId) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_FIRMID'));
 if(addr(T2QTradeFirmId) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradePartFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_PARTNER_FIRMID'));
 if(addr(T2QTradePartFirmId) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeExcCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_EXCHANGE_CODE'));
 if(addr(T2QTradeExcCode) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTradeStationId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_STATION_ID'));
 if(addr(T2QTradeStationId) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTransReplyClassCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_CLASS_CODE'));
 if(addr(T2QTransReplyClassCode) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTransReplySecCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_SEC_CODE'));
 if(addr(T2QTransReplySecCode) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTransReplyPrice := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_PRICE'));
 if(addr(T2QTransReplyPrice) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTransReplyQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_QUANTITY'));
 if(addr(T2QTransReplyQty) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTransReplyBal := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_BALANCE'));
 if(addr(T2QTransReplyBal) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTransReplyFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_FIRMID'));
 if(addr(T2QTransReplyFirmId) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTransReplyAccount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_ACCOUNT'));
 if(addr(T2QTransReplyAccount) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTransReplyClCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_CLIENT_CODE'));
 if(addr(T2QTransReplyClCode) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTransReplyBrRef := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_BROKERREF'));
 if(addr(T2QTransReplyBrRef) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
 @T2QTransReplyExcCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_EXCHANGE_CODE'));
 if(addr(T2QTransReplyExcCode) = nil) then
 begin
   Result:= 0;
   Exit;
 end;
end;

end.

Всё нормально, хендл получен адреса функций тоже ОК,
но, при вызове функции
//--- load trsns2quik.dll ----
 if (QuikPath <> '') then
   FDllHandle:= LibLoad(QuikPath);
 if(DllHandle > 0) then
 begin
   if(addr(T2QConnect) <> nil) then
     res:= T2QConnect(PAnsiChar(RawByteString(QuikPath + '\info.exe')), ErrCode, ErrStr, ErrSize);
 end;

Получаю ACCESS VIOLATION

Почему?
 
нашел ошибку!
Доджно быть
res:= T2QConnect(PAnsiChar(RawByteString(QuikPath)), ErrCode, ErrStr, ErrSize);
Без info.exe
 
Господа разработчики!

Очень странно, что Вы не предусмотрели ситуации, когда не влючён в Терминале импорт тразакций и не правильный путь к пакке Quik!
Почему вылетает в эксепшин?
Неужели трудно было в ДЛЛ сгенериравать код ошибки????!  
 
Цитата
Михаил Филимонов написал:
Господа разработчики!

Очень странно, что Вы не предусмотрели ситуации, когда не влючён в Терминале импорт тразакций и не правильный путь к пакке Quik!
Почему вылетает в эксепшин?
Неужели трудно было в ДЛЛ сгенериравать код ошибки????!
Добрый день,

Уточните, что именно аварийно завершает работу?
Используется ли Вами API_Tester_DLG из архива с библиотекой?
 
Добрый день, Станислав!

Вы, вероятно, ни название темы не читали, ни сами посты...
ПРИЛОЖЕН код, указана функция, в чём непонимание?
 
ВОТ здесь "валится"

//--- load trsns2quik.dll ----
 if (QuikPath <> '') then
   FDllHandle:= LibLoad(QuikPath);
 if(DllHandle > 0) then
 begin
   ErrCode:= 0;
   ErrSize:= 0;
   ErrStr:= nil;
   Res:= TRANS2QUIK_SUCCESS;
   try
     res:= T2QConnect(PAnsiChar(RawByteString(QuikPath)), ErrCode, ErrStr, ErrSize);
   except
     Application.MessageBox(PWideChar('Не вкючён в терминале ''Динамический импорт транзакций''.'+
                                      #10#13 +
                                      'Или не правильно указан путь к рабочей папке Quik.' +
                                      #10#13 + 'Программа будет закрыта.'),
                            PWideChar('ВНИМАНИЕ!'), MB_ICONHAND);
     FreeLibrary(FDllHandle);
     MainForm.Timer1.Enabled:= true;
     Exit;
   end;
 
Delphi XE4 API (подправленный)

unit tr2quik;

interface

uses
 WinApi.Windows, System.Sysutils;

const
 DllName = 'TRANS2QUIK.DLL';
//-------------- Constants --------------------------
 TRANS2QUIK_SUCCESS                   = 0;
 TRANS2QUIK_FAILED                    = 1;
 TRANS2QUIK_QUIK_TERMINAL_NOT_FOUND   = 2;
 TRANS2QUIK_DLL_VERSION_NOT_SUPPORTED = 3;
 TRANS2QUIK_ALREADY_CONNECTED_TO_QUIK = 4;
 TRANS2QUIK_WRONG_SYNTAX              = 5;
 TRANS2QUIK_QUIK_NOT_CONNECTED        = 6;
 TRANS2QUIK_DLL_NOT_CONNECTED         = 7;
 TRANS2QUIK_QUIK_CONNECTED            = 8;
 TRANS2QUIK_QUIK_DISCONNECTED         = 9;
 TRANS2QUIK_DLL_CONNECTED             = 10;
 TRANS2QUIK_DLL_DISCONNECTED          = 11;
 TRANS2QUIK_MEMORY_ALLOCATION_ERROR   = 12;
 TRANS2QUIK_WRONG_CONNECTION_HANDLE   = 13;
 TRANS2QUIK_WRONG_INPUT_PARAMS        = 14;

 ORDER_QUIKDATE          = 0;
 ORDER_QUIKTIME          = 1;
 ORDER_MICROSEC          = 2;
 ORDER_WITHDRAW_QUIKDATE = 3;
 ORDER_WITHDRAW_QUIKTIME = 4;
 ORDER_WITHDRAW_MICROSEC = 5;

 TRADE_QUIKDATE = 0;
 TRADE_QUIKTIME = 1;
 TRADE_MICROSEC = 2;

//------------------------- Types ------------------------------
type
 intptr_t = NativeInt;
 Quantity = int64;
 EntityNumber = uint64;
 PEntityNumber = ^EntityNumber;
 OrderDescr = intptr_t;
 TradeDescr = intptr_t;
 TransReplyDescr = intptr_t;

//-------- Load library function -------
 function LibLoad(const aPath: string): THandle;
//--- CallBack procedures --------------
 procedure pfConnStatusCB(nConnectionEvent: long;
                          nExtendedErrorCode: long;
              lpcstrInfoMessage: LPCSTR); stdcall;
 procedure pfOrderStatusCB(nMode: long;
                       dwTransID: DWORD;
                       dNumber: EntityNumber;
                       ClassCode: LPCSTR;
                       SecCode: LPCSTR;
                       dPrice: double;
                       nBalance: Quantity;
                       dValue: double;
                       nIsSell: long;
                       nStatus: long;
                       orderDescriptor: OrderDescr); stdcall;

 procedure pfTradeStatusCB(nMode: long;
                           dNumber: EntityNumber;
                           dOrderNumber: EntityNumber;
                           ClassCode: LPCSTR;
                           SecCode: LPCSTR;
                           dPrice: double;
                           nQty: Quantity;
                           dValue: double;
                           nIsSell: long;
                           tradeDescriptor: TradeDescr); stdcall;
 procedure pfTransReplyCB(nTransactionResult: long;
                          nTransactionExtendedErrorCode: long;
                          nTransactionReplyCode: long;
                          dwTransId: DWord;
                          nOrderNum: EntityNumber;
                          lpcstrTransactionReplyMessage: LPCSTR;
                          transReplyDescriptor: TransReplyDescr); stdcall;

type
//----------------------- Prototype CallBack procedures ------------------
 TRANS2QUIK_CONNECTION_STATUS_CALLBACK = procedure(nConnectionEvent: long;
                                     nExtendedErrorCode: long;
                                       lpcstrInfoMessage: LPCSTR); stdcall;

 TRANS2QUIK_TRANSACTION_REPLY_CALLBACK = procedure(nTransactionResult: long;
                                     nTransactionExtendedErrorCode: long;
                                     nTransactionReplyCode: long;
                                     dwTransId: DWord;
                                       nOrderNum: EntityNumber;
                                     lpcstrTransactionReplyMessage: LPCSTR;
                                     transReplyDescriptor: TransReplyDescr); stdcall;

 TRANS2QUIK_ORDER_STATUS_CALLBACK = procedure( nMode: long;
                                   dwTransID: DWORD;
                                 dNumber: EntityNumber;
                                 ClassCode: LPCSTR;
                                 SecCode: LPCSTR;
                                 dPrice: double;
                                 nBalance: Quantity;
                                 dValue: double;
                                 nIsSell: long;
                                 nStatus: long;
                                 orderDescriptor: OrderDescr); stdcall;

 TRANS2QUIK_TRADE_STATUS_CALLBACK = procedure( nMode: long;
                                 dNumber: EntityNumber;
                                 dOrderNumber: EntityNumber;
                                 ClassCode: LPCSTR;
                                 SecCode: LPCSTR;
                                 dPrice: double;
                                 nQty: Quantity;
                                 dValue: double;
                                 nIsSell: long;
                                 tradeDescriptor: TradeDescr); stdcall;
//------------ Functions -------------------
 TRANS2QUIK_SEND_SYNC_TRANSACTION = function(lpstTransactionString: LPSTR;
                                             var pnReplyCode: long;
                                              pdwTransId: PDWORD;
                                              var pnOrderNum:EntityNumber;
                                              lpstrResultMessage: LPSTR;
                                              dwResultMessageSize: DWORD;
                                              var pnExtendedErrorCode: long;
                                              lpstErrorMessage: LPSTR;
                                              dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_SEND_ASYNC_TRANSACTION = function(lpstTransactionString: LPSTR;
                                              var pnExtendedErrorCode: long;
                                              var lpstErrorMessage: LPSTR;
                                              var dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_CONNECT = function(lpstConnectionParamsString: LPSTR;
                               var pnExtendedErrorCode: long;
                               var lpstrErrorMessage: LPSTR;
                               var dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_DISCONNECT = function(var pnExtendedErrorCode: long;
                                  var lpstrErrorMessage: LPSTR;
                                  var dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_SET_CONNECTION_STATUS_CALLBACK = function(pfConnectionStatusCallback: TRANS2QUIK_CONNECTION_STATUS_CALLBACK;
                                                      var pnExtendedErrorCode: long;
                                                      var lpstrErrorMessage: LPSTR;
                                                      var dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_SET_TRANSACTIONS_REPLY_CALLBACK = function(pfTransactionReplyCallback: TRANS2QUIK_TRANSACTION_REPLY_CALLBACK;
                                                       pnExtendedErrorCode: long;
                                                       lpstrErrorMessage: LPSTR;
                                                       dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_IS_QUIK_CONNECTED = function(var pnExtendedErrorCode: long;
                                         lpstrErrorMessage: LPSTR;
                                         dwErrorMessageSize: Dword): long; stdcall;
 TRANS2QUIK_IS_DLL_CONNECTED = function(var pnExtendedErrorCode: long;
                                        lpstrErrorMessage: LPSTR;
                                        dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_SUBSCRIBE_ORDERS = function(ClassCode: LPSTR;
                                        Seccodes: LPSTR): long; stdcall;
 TRANS2QUIK_UNSUBSCRIBE_ORDERS = function(): long; stdcall;
 TRANS2QUIK_START_ORDERS = function(pfnOrderStatusCallback: TRANS2QUIK_ORDER_STATUS_CALLBACK): long; stdcall;
 TRANS2QUIK_ORDER_QTY = function(orderDescriptor: OrderDescr): Quantity; stdcall;
 TRANS2QUIK_ORDER_DATE = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_TIME = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_ACTIVATION_TIME = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_WITHDRAW_TIME = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_EXPIRY = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_ACCRUED_INT = function(orderDescriptor: OrderDescr): Double; stdcall;
 TRANS2QUIK_ORDER_YIELD = function(orderDescriptor: OrderDescr): double; stdcall;
 TRANS2QUIK_ORDER_UID = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_VISIBLE_QTY = function(orderDescriptor: OrderDescr): Quantity; stdcall;
 TRANS2QUIK_ORDER_PERIOD = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_FILETIME = function(orderDescriptor: OrderDescr): FILETIME; stdcall;
 TRANS2QUIK_ORDER_DATE_TIME = function(orderDescriptor: OrderDescr; nTimeType: long): long; stdcall;
 TRANS2QUIK_ORDER_WITHDRAW_FILETIME = function(orderDescriptor: OrderDescr): FILETIME; stdcall;
 TRANS2QUIK_ORDER_VALUE_ENTRY_TYPE = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_EXTENDED_FLAGS = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_MIN_QTY = function(orderDescriptor: OrderDescr): Quantity; stdcall;
 TRANS2QUIK_ORDER_EXEC_TYPE = function(orderDescriptor: OrderDescr): long; stdcall;
 TRANS2QUIK_ORDER_AWG_PRICE = function(orderDescriptor: OrderDescr): double; stdcall;
 TRANS2QUIK_ORDER_USERID = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
 TRANS2QUIK_ORDER_ACCOUNT = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
 TRANS2QUIK_ORDER_BROKERREF = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
 TRANS2QUIK_ORDER_CLIENT_CODE = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
 TRANS2QUIK_ORDER_FIRMID = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
 TRANS2QUIK_ORDER_REJECT_REASON = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
 TRANS2QUIK_SUBSCRIBE_TRADES = function(ClassCode: LPSTR; Seccodes: LPSTR): long; stdcall;
 TRANS2QUIK_UNSUBSCRIBE_TRADES = function(): long;  stdcall;
 TRANS2QUIK_START_TRADES = function(pfnTradeStatusCallback: TRANS2QUIK_TRADE_STATUS_CALLBACK): long; stdcall;
 TRANS2QUIK_TRADE_DATE = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_SETTLE_DATE = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_TIME = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_IS_MARGINAL = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_ACCRUED_INT = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_YIELD = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_TS_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_CLEARING_CENTER_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_EXCHANGE_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_TRADING_SYSTEM_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_PRICE2 = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_REPO_RATE = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_REPO_VALUE = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_REPO2_VALUE = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_ACCRUED_INT2 = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_REPO_TERM = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_START_DISCOUNT = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_LOWER_DISCOUNT = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_UPPER_DISCOUNT = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_BLOCK_SECURITIES = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_PERIOD = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_KIND = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_FILETIME = function(tradeDescriptor: TradeDescr): FILETIME; stdcall;
 TRANS2QUIK_TRADE_DATE_TIME = function(tradeDescriptor: TradeDescr; nTimeType: long): long; stdcall;
 TRANS2QUIK_TRADE_BROKER_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
 TRANS2QUIK_TRADE_TRANSID = function(tradeDescriptor: TradeDescr): long; stdcall;
 TRANS2QUIK_TRADE_CURRENCY = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_SETTLE_CURRENCY = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_SETTLE_CODE = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_ACCOUNT = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_BROKERREF = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_CLIENT_CODE = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_USERID = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_FIRMID = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_PARTNER_FIRMID = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_EXCHANGE_CODE = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_STATION_ID = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_CLASS_CODE = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_SEC_CODE = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_PRICE = function(tradeDescriptor: TransReplyDescr): double; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_QUANTITY = function(tradeDescriptor: TransReplyDescr): Quantity; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_BALANCE = function(tradeDescriptor: TransReplyDescr): Quantity; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_FIRMID = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_ACCOUNT = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_CLIENT_CODE = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_BROKERREF = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_EXCHANGE_CODE = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;

var
 T2QSendSyncTrans: TRANS2QUIK_SEND_SYNC_TRANSACTION;
 T2QSendASyncTrans: TRANS2QUIK_SEND_ASYNC_TRANSACTION;
 T2QConnect: TRANS2QUIK_CONNECT;
 T2QDisconnect: TRANS2QUIK_DISCONNECT;
 T2QSetConnStatCB: TRANS2QUIK_SET_CONNECTION_STATUS_CALLBACK;
 T2QSetTransReplyCB: TRANS2QUIK_SET_TRANSACTIONS_REPLY_CALLBACK;
 T2QIsQuikConnected: TRANS2QUIK_IS_QUIK_CONNECTED;
 T2QIsDllConnected: TRANS2QUIK_IS_DLL_CONNECTED;
 T2QSubscribeOrders: TRANS2QUIK_SUBSCRIBE_ORDERS;
 T2QUnSubscribeOrders: TRANS2QUIK_UNSUBSCRIBE_ORDERS;
 T2QStartOrders: TRANS2QUIK_START_ORDERS;
 T2QOrderQty: TRANS2QUIK_ORDER_QTY;
 T2QOrderDate: TRANS2QUIK_ORDER_DATE;
 T2QOrderTime: TRANS2QUIK_ORDER_TIME;
 T2QOrderActiveTime: TRANS2QUIK_ORDER_ACTIVATION_TIME;
 T2QOrderWithdrawTime: TRANS2QUIK_ORDER_WITHDRAW_TIME;
 T2QOrderExpiry: TRANS2QUIK_ORDER_EXPIRY;
 T2QOrderAccruedInt: TRANS2QUIK_ORDER_ACCRUED_INT;
 T2QOrderYield: TRANS2QUIK_ORDER_YIELD;
 T2QOrderUid: TRANS2QUIK_ORDER_UID;
 T2QOrderVisibleQty: TRANS2QUIK_ORDER_VISIBLE_QTY;
 T2QOrderPeriod: TRANS2QUIK_ORDER_PERIOD;
 T2QOrderFileTime: TRANS2QUIK_ORDER_FILETIME;
 T2QOrderDateTime: TRANS2QUIK_ORDER_DATE_TIME;
 T2QOrderWithdrawFileTime: TRANS2QUIK_ORDER_WITHDRAW_FILETIME;
 T2QOrderValueEntryType: TRANS2QUIK_ORDER_VALUE_ENTRY_TYPE;
 T2QOrderExtdFlags: TRANS2QUIK_ORDER_EXTENDED_FLAGS;
 T2QOrderMinQty: TRANS2QUIK_ORDER_MIN_QTY;
 T2QOrderExecType: TRANS2QUIK_ORDER_EXEC_TYPE;
 T2QOrderAwgPrice: TRANS2QUIK_ORDER_AWG_PRICE;
 T2QOrderUserId: TRANS2QUIK_ORDER_USERID;
 T2QOrderAccaunt: TRANS2QUIK_ORDER_ACCOUNT;
 T2QOrderBrokerRef: TRANS2QUIK_ORDER_BROKERREF;
 T2QOrderClientCode: TRANS2QUIK_ORDER_CLIENT_CODE;
 T2QOrderFirmId: TRANS2QUIK_ORDER_FIRMID;
 T2QOrderRejectReason: TRANS2QUIK_ORDER_REJECT_REASON;
 T2QSubscribeTrades: TRANS2QUIK_SUBSCRIBE_TRADES;
 T2QUnSubscribeTrades: TRANS2QUIK_UNSUBSCRIBE_TRADES;
 T2QStartTrades: TRANS2QUIK_START_TRADES;
 T2QTradeDate: TRANS2QUIK_TRADE_DATE;
 T2QTradeSettleDate: TRANS2QUIK_TRADE_SETTLE_DATE;
 T2QTradeTime: TRANS2QUIK_TRADE_TIME;
 T2QTradeIsMarginal: TRANS2QUIK_TRADE_IS_MARGINAL;
 T2QTradeAccruedInt: TRANS2QUIK_TRADE_ACCRUED_INT;
 T2QTradeYield: TRANS2QUIK_TRADE_YIELD;
 T2QTradeTSCommission: TRANS2QUIK_TRADE_TS_COMMISSION;
 T2QTradeClCenterCommission: TRANS2QUIK_TRADE_CLEARING_CENTER_COMMISSION;
 T2QTradeExcCommission: TRANS2QUIK_TRADE_EXCHANGE_COMMISSION;
 T2QTradeTrSysCommission: TRANS2QUIK_TRADE_TRADING_SYSTEM_COMMISSION;
 T2QTradePrice2: TRANS2QUIK_TRADE_PRICE2;
 T2QTradeRepoRate: TRANS2QUIK_TRADE_REPO_RATE;
 T2QTradeRepoValue: TRANS2QUIK_TRADE_REPO_VALUE;
 T2QTradeRepo2Value: TRANS2QUIK_TRADE_REPO2_VALUE;
 T2QTradeAccruedInt2: TRANS2QUIK_TRADE_ACCRUED_INT2;
 T2QTradeRepoTerm: TRANS2QUIK_TRADE_REPO_TERM;
 T2QTradeStDiscount: TRANS2QUIK_TRADE_START_DISCOUNT;
 T2QTradeLwDiscount: TRANS2QUIK_TRADE_LOWER_DISCOUNT;
 T2QTradeUpDiscount: TRANS2QUIK_TRADE_UPPER_DISCOUNT;
 T2QTradeBlSecur: TRANS2QUIK_TRADE_BLOCK_SECURITIES;
 T2QTradePeriod: TRANS2QUIK_TRADE_PERIOD;
 T2QTradeKind: TRANS2QUIK_TRADE_KIND;
 T2QTradeFileName: TRANS2QUIK_TRADE_FILETIME;
 T2QTradeDateTime: TRANS2QUIK_TRADE_DATE_TIME;
 T2QTradeBrCommission: TRANS2QUIK_TRADE_BROKER_COMMISSION;
 T2QTradeTransId: TRANS2QUIK_TRADE_TRANSID;
 T2QTradeCurrensy: TRANS2QUIK_TRADE_CURRENCY;
 T2QTradeSettlCurr: TRANS2QUIK_TRADE_SETTLE_CURRENCY;
 T2QTradeSettlCode: TRANS2QUIK_TRADE_SETTLE_CODE;
 T2QTradeAccount: TRANS2QUIK_TRADE_ACCOUNT;
 T2QTradeBrRef: TRANS2QUIK_TRADE_BROKERREF;
 T2QTradeClCode: TRANS2QUIK_TRADE_CLIENT_CODE;
 T2QTradeUserId: TRANS2QUIK_TRADE_USERID;
 T2QTradeFirmId: TRANS2QUIK_TRADE_FIRMID;
 T2QTradePartFirmId: TRANS2QUIK_TRADE_PARTNER_FIRMID;
 T2QTradeExcCode: TRANS2QUIK_TRADE_EXCHANGE_CODE;
 T2QTradeStationId: TRANS2QUIK_TRADE_STATION_ID;
 T2QTransReplyClassCode: TRANS2QUIK_TRANSACTION_REPLY_CLASS_CODE;
 T2QTransReplySecCode: TRANS2QUIK_TRANSACTION_REPLY_SEC_CODE;
 T2QTransReplyPrice: TRANS2QUIK_TRANSACTION_REPLY_PRICE;
 T2QTransReplyQty: TRANS2QUIK_TRANSACTION_REPLY_QUANTITY;
 T2QTransReplyBal: TRANS2QUIK_TRANSACTION_REPLY_BALANCE;
 T2QTransReplyFirmId: TRANS2QUIK_TRANSACTION_REPLY_FIRMID;
 T2QTransReplyAccount: TRANS2QUIK_TRANSACTION_REPLY_ACCOUNT;
 T2QTransReplyClCode: TRANS2QUIK_TRANSACTION_REPLY_CLIENT_CODE;
 T2QTransReplyBrRef: TRANS2QUIK_TRANSACTION_REPLY_BROKERREF;
 T2QTransReplyExcCode: TRANS2QUIK_TRANSACTION_REPLY_EXCHANGE_CODE;

implementation

uses
 Main;

function LibLoad(const aPath: string): THandle;
begin
 Result:= LoadLibrary(PWideChar(IncludeTrailingPathDelimiter(aPath) + DllName));
 if(Result > 0) then
 begin
   @T2QSendSyncTrans := GetProcAddress(Result, PWideChar('TRANS2QUIK_SEND_SYNC_TRANSACTION'));
   if(addr(T2QSendSyncTrans) = nil) then
   begin
      Result:= 0;
      Exit;
   end;
   @T2QSendASyncTrans := GetProcAddress(Result, PWideChar('TRANS2QUIK_SEND_ASYNC_TRANSACTION'));
   if(addr(T2QSendASyncTrans) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QConnect:= GetProcAddress(Result, PWideChar('TRANS2QUIK_CONNECT'));
   if(addr(T2QConnect) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QDisconnect := GetProcAddress(Result, PWideChar('TRANS2QUIK_DISCONNECT'));
   if(addr(T2QDisconnect) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QSetConnStatCB := GetProcAddress(Result, PWideChar('TRANS2QUIK_SET_CONNECTION_STATUS_CALLBACK'));
   if(addr(T2QSetConnStatCB) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QSetTransReplyCB := GetProcAddress(Result, PWideChar('TRANS2QUIK_SET_TRANSACTIONS_REPLY_CALLBACK'));
   if(addr(T2QSetTransReplyCB) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QIsQuikConnected := GetProcAddress(Result, PWideChar('TRANS2QUIK_IS_QUIK_CONNECTED'));
   if(addr(T2QIsQuikConnected) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QIsDllConnected := GetProcAddress(Result, PWideChar('TRANS2QUIK_IS_DLL_CONNECTED'));
   if(addr(T2QIsDllConnected) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QSubscribeOrders := GetProcAddress(Result, PWideChar('TRANS2QUIK_SUBSCRIBE_ORDERS'));
   if(addr(T2QSubscribeOrders) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QUnSubscribeOrders := GetProcAddress(Result, PWideChar('TRANS2QUIK_UNSUBSCRIBE_ORDERS'));
   if(addr(T2QUnSubscribeOrders) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QStartOrders := GetProcAddress(Result, PWideChar('TRANS2QUIK_START_ORDERS'));
   if(addr(T2QStartOrders) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_QTY'));
   if(addr(T2QOrderQty) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderDate := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_DATE'));
   if(addr(T2QOrderDate) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_TIME'));
   if(addr(T2QOrderTime) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderActiveTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_ACTIVATION_TIME'));
   if(addr(T2QOrderActiveTime) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderWithdrawTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_WITHDRAW_TIME'));
   if(addr(T2QOrderWithdrawTime) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderExpiry := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_EXPIRY'));
   if(addr(T2QOrderExpiry) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderAccruedInt := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_ACCRUED_INT'));
   if(addr(T2QOrderAccruedInt) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderYield := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_YIELD'));
   if(addr(T2QOrderYield) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderUid := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_UID'));
   if(addr(T2QOrderUid) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderVisibleQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_VISIBLE_QTY'));
   if(addr(T2QOrderVisibleQty) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderPeriod := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_PERIOD'));
   if(addr(T2QOrderPeriod) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderFileTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_FILETIME'));
   if(addr(T2QOrderFileTime) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderDateTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_DATE_TIME'));
   if(addr(T2QOrderDateTime) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderWithdrawFileTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_WITHDRAW_FILETIME'));
   if(addr(T2QOrderWithdrawFileTime) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderValueEntryType := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_VALUE_ENTRY_TYPE'));
   if(addr(T2QOrderValueEntryType) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderExtdFlags := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_EXTENDED_FLAGS'));
   if(addr(T2QOrderExtdFlags) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderMinQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_MIN_QTY'));
   if(addr(T2QOrderMinQty) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderExecType := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_EXEC_TYPE'));
   if(addr(T2QOrderExecType) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderAwgPrice := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_AWG_PRICE'));
   if(addr(T2QOrderAwgPrice) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderUserId := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_USERID'));
   if(addr(T2QOrderUserId) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderAccaunt := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_ACCOUNT'));
   if(addr(T2QOrderAccaunt) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderBrokerRef := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_BROKERREF'));
   if(addr(T2QOrderBrokerRef) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderClientCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_CLIENT_CODE'));
   if(addr(T2QOrderClientCode) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_FIRMID'));
   if(addr(T2QOrderFirmId) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderRejectReason := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_REJECT_REASON'));
   if(addr(T2QOrderRejectReason) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QSubscribeTrades := GetProcAddress(Result, PWideChar('TRANS2QUIK_SUBSCRIBE_TRADES'));
   if(addr(T2QSubscribeTrades) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QUnSubscribeTrades := GetProcAddress(Result, PWideChar('TRANS2QUIK_UNSUBSCRIBE_TRADES'));
   if(addr(T2QUnSubscribeTrades) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QStartTrades := GetProcAddress(Result, PWideChar('TRANS2QUIK_START_TRADES'));
   if(addr(T2QStartTrades) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeDate := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_DATE'));
   if(addr(T2QTradeDate) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeSettleDate := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_SETTLE_DATE'));
   if(addr(T2QTradeSettleDate) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TIME'));
   if(addr(T2QTradeTime) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeIsMarginal := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_IS_MARGINAL'));
   if(addr(T2QTradeIsMarginal) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeAccruedInt := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_ACCRUED_INT'));
   if(addr(T2QTradeAccruedInt) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeYield := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_YIELD'));
   if(addr(T2QTradeYield) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeTSCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TS_COMMISSION'));
   if(addr(T2QTradeTSCommission) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeClCenterCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TS_COMMISSION'));
   if(addr(T2QTradeClCenterCommission) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeExcCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_EXCHANGE_COMMISSION'));
   if(addr(T2QTradeExcCommission) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeTrSysCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TRADING_SYSTEM_COMMISSION'));
   if(addr(T2QTradeTrSysCommission) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradePrice2 := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_PRICE2'));
   if(addr(T2QTradePrice2) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeRepoRate := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO_RATE'));
   if(addr(T2QTradeRepoRate) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeRepoValue := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO_VALUE'));
   if(addr(T2QTradeRepoValue) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeRepo2Value := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO2_VALUE'));
   if(addr(T2QTradeRepo2Value) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeAccruedInt2 := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_ACCRUED_INT2'));
   if(addr(T2QTradeAccruedInt2) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeRepoTerm := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO_TERM'));
   if(addr(T2QTradeRepoTerm) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeStDiscount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_START_DISCOUNT'));
   if(addr(T2QTradeStDiscount) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeLwDiscount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_LOWER_DISCOUNT'));
   if(addr(T2QTradeLwDiscount) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeUpDiscount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_UPPER_DISCOUNT'));
   if(addr(T2QTradeUpDiscount) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeBlSecur := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_UPPER_DISCOUNT'));
   if(addr(T2QTradeBlSecur) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradePeriod := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_PERIOD'));
   if(addr(T2QTradePeriod) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeKind := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_KIND'));
   if(addr(T2QTradeKind) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeFileName := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_FILETIME'));
   if(addr(T2QTradeFileName) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeDateTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_DATE_TIME'));
   if(addr(T2QTradeDateTime) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeBrCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_BROKER_COMMISSION'));
   if(addr(T2QTradeBrCommission) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeTransId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TRANSID'));
   if(addr(T2QTradeTransId) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeCurrensy := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_CURRENCY'));
   if(addr(T2QTradeCurrensy) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeSettlCurr := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_SETTLE_CURRENCY'));
   if(addr(T2QTradeSettlCurr) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeSettlCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_SETTLE_CODE'));
   if(addr(T2QTradeSettlCode) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeAccount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_ACCOUNT'));
   if(addr(T2QTradeAccount) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeBrRef := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_BROKERREF'));
   if(addr(T2QTradeBrRef) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeClCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_CLIENT_CODE'));
   if(addr(T2QTradeClCode) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeUserId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_USERID'));
   if(addr(T2QTradeUserId) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_FIRMID'));
   if(addr(T2QTradeFirmId) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradePartFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_PARTNER_FIRMID'));
   if(addr(T2QTradePartFirmId) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeExcCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_EXCHANGE_CODE'));
   if(addr(T2QTradeExcCode) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeStationId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_STATION_ID'));
   if(addr(T2QTradeStationId) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyClassCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_CLASS_CODE'));
   if(addr(T2QTransReplyClassCode) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplySecCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_SEC_CODE'));
   if(addr(T2QTransReplySecCode) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyPrice := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_PRICE'));
   if(addr(T2QTransReplyPrice) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_QUANTITY'));
   if(addr(T2QTransReplyQty) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyBal := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_BALANCE'));
   if(addr(T2QTransReplyBal) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_FIRMID'));
   if(addr(T2QTransReplyFirmId) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyAccount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_ACCOUNT'));
   if(addr(T2QTransReplyAccount) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyClCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_CLIENT_CODE'));
   if(addr(T2QTransReplyClCode) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyBrRef := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_BROKERREF'));
   if(addr(T2QTransReplyBrRef) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyExcCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_EXCHANGE_CODE'));
   if(addr(T2QTransReplyExcCode) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
 end;
end;

//--- CallBacks ---------
procedure pfConnStatusCB;
var
 ErrCode: long;
 ErrStr: PAnsiChar;
 ErrSize: Dword;
begin
 case nConnectionEvent of
   TRANS2QUIK_QUIK_CONNECTED: QTrader.QConn:= true;
   TRANS2QUIK_QUIK_DISCONNECTED: QTrader.QConn:= false;
   TRANS2QUIK_DLL_CONNECTED: QTrader.DllConn:= true;
   TRANS2QUIK_DLL_DISCONNECTED: begin
     QTrader.DllConn:= false;
     ErrCode:= 0;
     ErrStr:= nil;
     ErrSize:= 0;
//--- Try to connect ----
     T2QConnect(PAnsiChar(RawByteString(QTrader.QuikPath)), ErrCode, ErrStr, ErrSize);
     QTrader.LastErrMsg:= string(ErrStr);
     QTrader.LastErrCode:= ErrCode;
   end;
 end;
end;


procedure pfTransReplyCB;
begin
 //TODO Find Child and call procedure
end;

procedure pfOrderStatusCB;
begin
 //TODO Find Child and call procedure
end;

procedure pfTradeStatusCB;
begin
 //TODO Find Child and call procedure
end;

end.
 
Здравствуйте.

Пытаюсь повторить код описанный выше, DLL вроде грузится

Result:= LoadLibrary(PWideChar(IncludeTrailingPathDelimiter(aPath) + DllName ));

Result - не nil

, но при попытке получить ссылку на конкретную функцию - ошибка

@T2QSendSyncTrans := GetProcAddress(Result, PAnsiChar('TRANS2QUIK_SEND_SYNC_TRANSACTION'));

@T2QSendSyncTrans возвращает nil

Использую Embarcadero® Delphi 10.3 + Trans2QUIK версии 1.2.

В чем может быть дело ?
 
Roman, добрый день!

Цитата
Roman написал:
Пытаюсь повторить код описанный выше
В таком случае, в первую очередь рекомендуем попробовать
Код
@T2QSendSyncTrans := GetProcAddress(Result, PWideChar('TRANS2QUIK_SEND_SYNC_TRANSACTION'));
Вместо
Код
@T2QSendSyncTrans := GetProcAddress(Result, PAnsiChar('TRANS2QUIK_SEND_SYNC_TRANSACTION'));
 
Пробовал не помогло.

Нашел в чем дело , оказалось если вместо:

@T2QSendSyncTrans := GetProcAddress(Result, PWideChar('TRANS2QUIK_SEND_SYNC_TRANSACTION'));

написать

@T2QSendSyncTrans := GetProcAddress(Result, PWideChar('_TRANS2QUIK_SEND_SYNC_TRANSACTION@36'));

то все работает
 
Цитата
Roman написал:
Пробовал не помогло.

Нашел в чем дело , оказалось если вместо:

@T2QSendSyncTrans := GetProcAddress(Result, PWideChar( 'TRANS2QUIK_SEND_SYNC_TRANSACTION '));

написать

@T2QSendSyncTrans := GetProcAddress(Result, PWideChar(' _TRANS2QUIK_SEND_SYNC_TRANSACTION@36 '));

то все работает
Я выкладывал полностью рабочий модуль, переписанный из исходника разработчиков, и у меня все прекрасно работает.
Это Вы где-то намудрили
 
Выкладываю еще раз

unit tr2quik;

interface

uses
 WinApi.Windows, System.Sysutils;

//var
//  DllName: string;// = 'TRANS2QUIK.DLL';

const
 WM_ON_TRADE = WM_USER + 179;

//------------ Constants ------------
 TRANS2QUIK_UNKNOWN                   = -1;
 TRANS2QUIK_SUCCESS                   = 0;
 TRANS2QUIK_FAILED                    = 1;
 TRANS2QUIK_QUIK_TERMINAL_NOT_FOUND   = 2;
 TRANS2QUIK_DLL_VERSION_NOT_SUPPORTED = 3;
 TRANS2QUIK_ALREADY_CONNECTED_TO_QUIK = 4;
 TRANS2QUIK_WRONG_SYNTAX              = 5;
 TRANS2QUIK_QUIK_NOT_CONNECTED        = 6;
 TRANS2QUIK_DLL_NOT_CONNECTED         = 7;
 TRANS2QUIK_QUIK_CONNECTED            = 8;
 TRANS2QUIK_QUIK_DISCONNECTED         = 9;
 TRANS2QUIK_DLL_CONNECTED             = 10;
 TRANS2QUIK_DLL_DISCONNECTED          = 11;
 TRANS2QUIK_MEMORY_ALLOCATION_ERROR   = 12;
 TRANS2QUIK_WRONG_CONNECTION_HANDLE   = 13;
 TRANS2QUIK_WRONG_INPUT_PARAMS        = 14;

 ORDER_QUIKDATE          = 0;
 ORDER_QUIKTIME          = 1;
 ORDER_MICROSEC          = 2;
 ORDER_WITHDRAW_QUIKDATE = 3;
 ORDER_WITHDRAW_QUIKTIME = 4;
 ORDER_WITHDRAW_MICROSEC = 5;

 TRADE_QUIKDATE = 0;
 TRADE_QUIKTIME = 1;
 TRADE_MICROSEC = 2;

 REPL_NONE  = 0;
 REPL_TRANS = 1;
 REPL_ORDER = 2;
 REPL_TRADE = 3;

//--- DLL ERRORS ---
 TR2QUIK_TERMINAL_CLOSED      = 109;
 TR2QUIK_TRANSACTION_FAIL     = 233;
 TR2QUIK_NOT_SUBSCRIBE_ORDERS = $1000;
 TR2QUIK_NOT_SUBSCRIBE_TRADES = $1001;

//--------- Types ------
type
 intptr_t = NativeInt;
 Quantity = int64;
 EntityNumber = uint64;
 PEntityNumber = ^EntityNumber;
 OrderDescriptor = intptr_t;
 TradeDescriptor = intptr_t;
 TransReplyDescriptor = intptr_t;

//-------- Load library function -------
 function LibLoad(const aPath: string): THandle;

//--- CallBack procedures --------------
 procedure pfConnStatusCB(nConnectionEvent: long;
                          nExtendedErrorCode: long;
              lpcstrInfoMessage: LPCSTR); stdcall;

 procedure pfOrderStatusCB(nMode: long;
                           dwTransID: DWORD;
                           dNumber: EntityNumber;
                           ClassCode: LPCSTR;
                           SecCode: LPCSTR;
                           dPrice: double;
                           nBalance: Quantity;
                           dValue: double;
                           nIsSell: long;
                           nStatus: long;
                           ordDescr: OrderDescriptor); stdcall;

 procedure pfTradeStatusCB(nMode: long;
                           dNumber: EntityNumber;
                           dOrderNumber: EntityNumber;
                           ClassCode: LPCSTR;
                           SecCode: LPCSTR;
                           dPrice: double;
                           nQty: Quantity;
                           dValue: double;
                           nIsSell: long;
                           trDescriptor: TradeDescriptor); stdcall;

 procedure pfTransReplyCB(nTransactionResult: long;
                          nTransactionExtendedErrorCode: long;
                          nTransactionReplyCode: long;
                          dwTransId: DWord;
                          nOrderNum: EntityNumber;
                          lpcstrTransactionReplyMessage: LPCSTR;
                          trReplyDescr: TransReplyDescriptor); stdcall;

type
//----------------------- Prototype CallBack procedures ------------------
 TRANS2QUIK_CONNECTION_STATUS_CALLBACK = procedure(nConnectionEvent: long;
                                     nExtendedErrorCode: long;
                                       lpcstrInfoMessage: LPCSTR); stdcall;

 TRANS2QUIK_TRANSACTION_REPLY_CALLBACK = procedure(nTransactionResult: long;
                                     nTransactionExtendedErrorCode: long;
                                     nTransactionReplyCode: long;
                                     dwTransId: DWord;
                                       nOrderNum: EntityNumber;
                                     lpcstrTransactionReplyMessage: LPCSTR;
                                     trReplDesc: TransReplyDescriptor); stdcall;

 TRANS2QUIK_ORDER_STATUS_CALLBACK = procedure( nMode: long;
                                   dwTransID: DWORD;
                                 dNumber: EntityNumber;
                                 ClassCode: LPCSTR;
                                 SecCode: LPCSTR;
                                 dPrice: double;
                                 nBalance: Quantity;
                                 dValue: double;
                                 nIsSell: long;
                                 nStatus: long;
                                 orderDescriptor: OrderDescriptor); stdcall;

 TRANS2QUIK_TRADE_STATUS_CALLBACK = procedure( nMode: long;
                                 dNumber: EntityNumber;
                                 dOrderNumber: EntityNumber;
                                 ClassCode: LPCSTR;
                                 SecCode: LPCSTR;
                                 dPrice: double;
                                 nQty: Quantity;
                                 dValue: double;
                                 nIsSell: long;
                                 tradeDescriptor: TradeDescriptor); stdcall;
//------------ Functions -------------------
 TRANS2QUIK_SEND_SYNC_TRANSACTION = function(lpstTransactionString: LPSTR;
                                             var pnReplyCode: long;
                                             var pdwTransId: PDWORD;
                                             var pnOrderNum:EntityNumber;
                                             lpstrResultMessage: LPSTR;
                                             var dwResultMessageSize: DWORD;
                                             var pnExtendedErrorCode: long;
                                             lpstErrorMessage: LPSTR;
                                             var dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_SEND_ASYNC_TRANSACTION = function(lpstTransactionString: LPSTR;
                                              var pnExtendedErrorCode: long;
                                              lpstErrorMessage: LPSTR;
                                              var dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_CONNECT = function(lpstConnectionParamsString: LPSTR;
                               var pnExtendedErrorCode: long;
                               lpstrErrorMessage: LPSTR;
                               var dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_DISCONNECT = function(var pnExtendedErrorCode: long;
                                  lpstrErrorMessage: LPSTR;
                                  var dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_SET_CONNECTION_STATUS_CALLBACK = function(pfConnectionStatusCallback: TRANS2QUIK_CONNECTION_STATUS_CALLBACK;
                                                      var pnExtendedErrorCode: long;
                                                      lpstrErrorMessage: LPSTR;
                                                      var dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_SET_TRANSACTIONS_REPLY_CALLBACK = function(pfTransactionReplyCallback: TRANS2QUIK_TRANSACTION_REPLY_CALLBACK;
                                                       var pnExtendedErrorCode: long;
                                                       lpstrErrorMessage: LPSTR;
                                                       var dwErrorMessageSize: DWORD): long; stdcall;
 TRANS2QUIK_IS_QUIK_CONNECTED = function(var pnExtendedErrorCode: long;
                                         lpstrErrorMessage: LPSTR;
                                         var dwErrorMessageSize: Dword): long; stdcall;
 TRANS2QUIK_IS_DLL_CONNECTED = function(var pnExtendedErrorCode: long;
                                        lpstrErrorMessage: LPSTR;
                                        var dwErrorMessageSize: DWORD): long; stdcall;
//---
 TRANS2QUIK_SUBSCRIBE_ORDERS = function(ClassCode: LPSTR; Seccodes: LPSTR): long; stdcall;
 TRANS2QUIK_UNSUBSCRIBE_ORDERS = function(): long; stdcall;
 TRANS2QUIK_SUBSCRIBE_TRADES = function(ClassCode: LPSTR; Seccodes: LPSTR): long; stdcall;
 TRANS2QUIK_UNSUBSCRIBE_TRADES = function(): long;  stdcall;
//---
 TRANS2QUIK_START_TRADES = function(pfnTradeStatusCallback: TRANS2QUIK_TRADE_STATUS_CALLBACK): long; stdcall;
 TRANS2QUIK_START_ORDERS = function(pfnOrderStatusCallback: TRANS2QUIK_ORDER_STATUS_CALLBACK): long; stdcall;
//---
 TRANS2QUIK_ORDER_QTY = function(orderDescriptor: OrderDescriptor): Quantity; stdcall;
 TRANS2QUIK_ORDER_DATE = function(orderDescriptor: OrderDescriptor): long; stdcall;
 TRANS2QUIK_ORDER_TIME = function(orderDescriptor: OrderDescriptor): long; stdcall;
 TRANS2QUIK_ORDER_ACTIVATION_TIME = function(orderDescriptor: OrderDescriptor): long; stdcall;
 TRANS2QUIK_ORDER_WITHDRAW_TIME = function(orderDescriptor: OrderDescriptor): long; stdcall;
 TRANS2QUIK_ORDER_EXPIRY = function(orderDescriptor: OrderDescriptor): long; stdcall;
 TRANS2QUIK_ORDER_ACCRUED_INT = function(orderDescriptor: OrderDescriptor): Double; stdcall;
 TRANS2QUIK_ORDER_YIELD = function(orderDescriptor: OrderDescriptor): double; stdcall;
 TRANS2QUIK_ORDER_UID = function(orderDescriptor: OrderDescriptor): long; stdcall;
 TRANS2QUIK_ORDER_VISIBLE_QTY = function(orderDescriptor: OrderDescriptor): Quantity; stdcall;
 TRANS2QUIK_ORDER_PERIOD = function(orderDescriptor: OrderDescriptor): long; stdcall;
 TRANS2QUIK_ORDER_FILETIME = function(orderDescriptor: OrderDescriptor): FILETIME; stdcall;
 TRANS2QUIK_ORDER_DATE_TIME = function(orderDescriptor: OrderDescriptor; nTimeType: long): long; stdcall;
 TRANS2QUIK_ORDER_WITHDRAW_FILETIME = function(orderDescriptor: OrderDescriptor): FILETIME; stdcall;
 TRANS2QUIK_ORDER_VALUE_ENTRY_TYPE = function(orderDescriptor: OrderDescriptor): long; stdcall;
 TRANS2QUIK_ORDER_EXTENDED_FLAGS = function(orderDescriptor: OrderDescriptor): long; stdcall;
 TRANS2QUIK_ORDER_MIN_QTY = function(orderDescriptor: OrderDescriptor): Quantity; stdcall;
 TRANS2QUIK_ORDER_EXEC_TYPE = function(orderDescriptor: OrderDescriptor): long; stdcall;
 TRANS2QUIK_ORDER_AWG_PRICE = function(orderDescriptor: OrderDescriptor): double; stdcall;
 TRANS2QUIK_ORDER_USERID = function(orderDescriptor: OrderDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_ORDER_ACCOUNT = function(orderDescriptor: OrderDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_ORDER_BROKERREF = function(orderDescriptor: OrderDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_ORDER_CLIENT_CODE = function(orderDescriptor: OrderDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_ORDER_FIRMID = function(orderDescriptor: OrderDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_ORDER_REJECT_REASON = function(orderDescriptor: OrderDescriptor): LPTSTR; stdcall;
//---
 TRANS2QUIK_TRADE_DATE = function(tradeDescriptor: TradeDescriptor): long; stdcall;
 TRANS2QUIK_TRADE_SETTLE_DATE = function(tradeDescriptor: TradeDescriptor): long; stdcall;
 TRANS2QUIK_TRADE_TIME = function(tradeDescriptor: TradeDescriptor): long; stdcall;
 TRANS2QUIK_TRADE_IS_MARGINAL = function(tradeDescriptor: TradeDescriptor): long; stdcall;
 TRANS2QUIK_TRADE_ACCRUED_INT = function(tradeDescriptor: TradeDescriptor): double; stdcall;
 TRANS2QUIK_TRADE_YIELD = function(tradeDescriptor: TradeDescriptor): double; stdcall;
 TRANS2QUIK_TRADE_TS_COMMISSION = function(tradeDescriptor: TradeDescriptor): double; stdcall;
 TRANS2QUIK_TRADE_CLEARING_CENTER_COMMISSION = function(tradeDescriptor: TradeDescriptor): double; stdcall;
 TRANS2QUIK_TRADE_EXCHANGE_COMMISSION = function(tradeDescriptor: TradeDescriptor): double; stdcall;
 TRANS2QUIK_TRADE_TRADING_SYSTEM_COMMISSION = function(tradeDescriptor: TradeDescriptor): double; stdcall;
 TRANS2QUIK_TRADE_PRICE2 = function(tradeDescriptor: TradeDescriptor): double; stdcall;
 TRANS2QUIK_TRADE_REPO_RATE = function(tradeDescriptor: TradeDescriptor): double; stdcall;
 TRANS2QUIK_TRADE_REPO_VALUE = function(tradeDescriptor: TradeDescriptor): double; stdcall;
 TRANS2QUIK_TRADE_REPO2_VALUE = function(tradeDescriptor: TradeDescriptor): double; stdcall;
 TRANS2QUIK_TRADE_ACCRUED_INT2 = function(tradeDescriptor: TradeDescriptor): double; stdcall;
 TRANS2QUIK_TRADE_REPO_TERM = function(tradeDescriptor: TradeDescriptor): long; stdcall;
 TRANS2QUIK_TRADE_START_DISCOUNT = function(tradeDescriptor: TradeDescriptor): double; stdcall;
 TRANS2QUIK_TRADE_LOWER_DISCOUNT = function(tradeDescriptor: TradeDescriptor): double; stdcall;
 TRANS2QUIK_TRADE_UPPER_DISCOUNT = function(tradeDescriptor: TradeDescriptor): double; stdcall;
 TRANS2QUIK_TRADE_BLOCK_SECURITIES = function(tradeDescriptor: TradeDescriptor): long; stdcall;
 TRANS2QUIK_TRADE_PERIOD = function(tradeDescriptor: TradeDescriptor): long; stdcall;
 TRANS2QUIK_TRADE_KIND = function(tradeDescriptor: TradeDescriptor): long; stdcall;
 TRANS2QUIK_TRADE_FILETIME = function(tradeDescriptor: TradeDescriptor): FILETIME; stdcall;
 TRANS2QUIK_TRADE_DATE_TIME = function(tradeDescriptor: TradeDescriptor; nTimeType: long): long; stdcall;
 TRANS2QUIK_TRADE_BROKER_COMMISSION = function(tradeDescriptor: TradeDescriptor): double; stdcall;
 TRANS2QUIK_TRADE_TRANSID = function(tradeDescriptor: TradeDescriptor): long; stdcall;
 TRANS2QUIK_TRADE_CURRENCY = function(tradeDescriptor: TradeDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_SETTLE_CURRENCY = function(tradeDescriptor: TradeDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_SETTLE_CODE = function(tradeDescriptor: TradeDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_ACCOUNT = function(tradeDescriptor: TradeDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_BROKERREF = function(tradeDescriptor: TradeDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_CLIENT_CODE = function(tradeDescriptor: TradeDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_USERID = function(tradeDescriptor: TradeDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_FIRMID = function(tradeDescriptor: TradeDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_PARTNER_FIRMID = function(tradeDescriptor: TradeDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_EXCHANGE_CODE = function(tradeDescriptor: TradeDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_TRADE_STATION_ID = function(tradeDescriptor: TradeDescriptor): LPTSTR; stdcall;
//---
 TRANS2QUIK_TRANSACTION_REPLY_CLASS_CODE = function(TRD: TransReplyDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_SEC_CODE = function(TRD: TransReplyDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_PRICE = function(TRD: TransReplyDescriptor): double; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_QUANTITY = function(TRD: TransReplyDescriptor): Quantity; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_BALANCE = function(TRD: TransReplyDescriptor): Quantity; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_FIRMID = function(TRD: TransReplyDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_ACCOUNT = function(TRD: TransReplyDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_CLIENT_CODE = function(TRD: TransReplyDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_BROKERREF = function(TRD: TransReplyDescriptor): LPTSTR; stdcall;
 TRANS2QUIK_TRANSACTION_REPLY_EXCHANGE_CODE = function(TRD: TransReplyDescriptor): LPTSTR; stdcall;

var
 T2QSendSyncTrans: TRANS2QUIK_SEND_SYNC_TRANSACTION;
 T2QSendASyncTrans: TRANS2QUIK_SEND_ASYNC_TRANSACTION;
 T2QConnect: TRANS2QUIK_CONNECT;
 T2QDisconnect: TRANS2QUIK_DISCONNECT;
 T2QSetConnStatCB: TRANS2QUIK_SET_CONNECTION_STATUS_CALLBACK;
 T2QSetTransReplyCB: TRANS2QUIK_SET_TRANSACTIONS_REPLY_CALLBACK;
 T2QIsQuikConnected: TRANS2QUIK_IS_QUIK_CONNECTED;
 T2QIsDllConnected: TRANS2QUIK_IS_DLL_CONNECTED;
 T2QSubscribeOrders: TRANS2QUIK_SUBSCRIBE_ORDERS;
 T2QUnSubscribeOrders: TRANS2QUIK_UNSUBSCRIBE_ORDERS;
 T2QStartOrders: TRANS2QUIK_START_ORDERS;
 T2QOrderQty: TRANS2QUIK_ORDER_QTY;
 T2QOrderDate: TRANS2QUIK_ORDER_DATE;
 T2QOrderTime: TRANS2QUIK_ORDER_TIME;
 T2QOrderActiveTime: TRANS2QUIK_ORDER_ACTIVATION_TIME;
 T2QOrderWithdrawTime: TRANS2QUIK_ORDER_WITHDRAW_TIME;
 T2QOrderExpiry: TRANS2QUIK_ORDER_EXPIRY;
 T2QOrderAccruedInt: TRANS2QUIK_ORDER_ACCRUED_INT;
 T2QOrderYield: TRANS2QUIK_ORDER_YIELD;
 T2QOrderUid: TRANS2QUIK_ORDER_UID;
 T2QOrderVisibleQty: TRANS2QUIK_ORDER_VISIBLE_QTY;
 T2QOrderPeriod: TRANS2QUIK_ORDER_PERIOD;
 T2QOrderFileTime: TRANS2QUIK_ORDER_FILETIME;
 T2QOrderDateTime: TRANS2QUIK_ORDER_DATE_TIME;
 T2QOrderWithdrawFileTime: TRANS2QUIK_ORDER_WITHDRAW_FILETIME;
 T2QOrderValueEntryType: TRANS2QUIK_ORDER_VALUE_ENTRY_TYPE;
 T2QOrderExtdFlags: TRANS2QUIK_ORDER_EXTENDED_FLAGS;
 T2QOrderMinQty: TRANS2QUIK_ORDER_MIN_QTY;
 T2QOrderExecType: TRANS2QUIK_ORDER_EXEC_TYPE;
 T2QOrderAwgPrice: TRANS2QUIK_ORDER_AWG_PRICE;
 T2QOrderUserId: TRANS2QUIK_ORDER_USERID;
 T2QOrderAccaunt: TRANS2QUIK_ORDER_ACCOUNT;
 T2QOrderBrokerRef: TRANS2QUIK_ORDER_BROKERREF;
 T2QOrderClientCode: TRANS2QUIK_ORDER_CLIENT_CODE;
 T2QOrderFirmId: TRANS2QUIK_ORDER_FIRMID;
 T2QOrderRejectReason: TRANS2QUIK_ORDER_REJECT_REASON;
 T2QSubscribeTrades: TRANS2QUIK_SUBSCRIBE_TRADES;
 T2QUnSubscribeTrades: TRANS2QUIK_UNSUBSCRIBE_TRADES;
 T2QStartTrades: TRANS2QUIK_START_TRADES;
 T2QTradeDate: TRANS2QUIK_TRADE_DATE;
 T2QTradeSettleDate: TRANS2QUIK_TRADE_SETTLE_DATE;
 T2QTradeTime: TRANS2QUIK_TRADE_TIME;
 T2QTradeIsMarginal: TRANS2QUIK_TRADE_IS_MARGINAL;
 T2QTradeAccruedInt: TRANS2QUIK_TRADE_ACCRUED_INT;
 T2QTradeYield: TRANS2QUIK_TRADE_YIELD;
 T2QTradeTSCommission: TRANS2QUIK_TRADE_TS_COMMISSION;
 T2QTradeClCenterCommission: TRANS2QUIK_TRADE_CLEARING_CENTER_COMMISSION;
 T2QTradeExcCommission: TRANS2QUIK_TRADE_EXCHANGE_COMMISSION;
 T2QTradeTrSysCommission: TRANS2QUIK_TRADE_TRADING_SYSTEM_COMMISSION;
 T2QTradePrice2: TRANS2QUIK_TRADE_PRICE2;
 T2QTradeRepoRate: TRANS2QUIK_TRADE_REPO_RATE;
 T2QTradeRepoValue: TRANS2QUIK_TRADE_REPO_VALUE;
 T2QTradeRepo2Value: TRANS2QUIK_TRADE_REPO2_VALUE;
 T2QTradeAccruedInt2: TRANS2QUIK_TRADE_ACCRUED_INT2;
 T2QTradeRepoTerm: TRANS2QUIK_TRADE_REPO_TERM;
 T2QTradeStDiscount: TRANS2QUIK_TRADE_START_DISCOUNT;
 T2QTradeLwDiscount: TRANS2QUIK_TRADE_LOWER_DISCOUNT;
 T2QTradeUpDiscount: TRANS2QUIK_TRADE_UPPER_DISCOUNT;
 T2QTradeBlSecur: TRANS2QUIK_TRADE_BLOCK_SECURITIES;
 T2QTradePeriod: TRANS2QUIK_TRADE_PERIOD;
 T2QTradeKind: TRANS2QUIK_TRADE_KIND;
 T2QTradeFileName: TRANS2QUIK_TRADE_FILETIME;
 T2QTradeDateTime: TRANS2QUIK_TRADE_DATE_TIME;
 T2QTradeBrCommission: TRANS2QUIK_TRADE_BROKER_COMMISSION;
 T2QTradeTransId: TRANS2QUIK_TRADE_TRANSID;
 T2QTradeCurrensy: TRANS2QUIK_TRADE_CURRENCY;
 T2QTradeSettlCurr: TRANS2QUIK_TRADE_SETTLE_CURRENCY;
 T2QTradeSettlCode: TRANS2QUIK_TRADE_SETTLE_CODE;
 T2QTradeAccount: TRANS2QUIK_TRADE_ACCOUNT;
 T2QTradeBrRef: TRANS2QUIK_TRADE_BROKERREF;
 T2QTradeClCode: TRANS2QUIK_TRADE_CLIENT_CODE;
 T2QTradeUserId: TRANS2QUIK_TRADE_USERID;
 T2QTradeFirmId: TRANS2QUIK_TRADE_FIRMID;
 T2QTradePartFirmId: TRANS2QUIK_TRADE_PARTNER_FIRMID;
 T2QTradeExcCode: TRANS2QUIK_TRADE_EXCHANGE_CODE;
 T2QTradeStationId: TRANS2QUIK_TRADE_STATION_ID;
 T2QTransReplyClassCode: TRANS2QUIK_TRANSACTION_REPLY_CLASS_CODE;
 T2QTransReplySecCode: TRANS2QUIK_TRANSACTION_REPLY_SEC_CODE;
 T2QTransReplyPrice: TRANS2QUIK_TRANSACTION_REPLY_PRICE;
 T2QTransReplyQty: TRANS2QUIK_TRANSACTION_REPLY_QUANTITY;
 T2QTransReplyBal: TRANS2QUIK_TRANSACTION_REPLY_BALANCE;
 T2QTransReplyFirmId: TRANS2QUIK_TRANSACTION_REPLY_FIRMID;
 T2QTransReplyAccount: TRANS2QUIK_TRANSACTION_REPLY_ACCOUNT;
 T2QTransReplyClCode: TRANS2QUIK_TRANSACTION_REPLY_CLIENT_CODE;
 T2QTransReplyBrRef: TRANS2QUIK_TRANSACTION_REPLY_BROKERREF;
 T2QTransReplyExcCode: TRANS2QUIK_TRANSACTION_REPLY_EXCHANGE_CODE;

implementation
 uses Main, CHILDWIN;

function LibLoad(const aPath: string): THandle;
begin
 Result:= LoadLibrary(PWideChar(IncludeTrailingPathDelimiter(aPath) + MainData.DllName));
 if(Result > 0) then
 begin
   @T2QSendSyncTrans := GetProcAddress(Result, PWideChar('TRANS2QUIK_SEND_SYNC_TRANSACTION'));
   if(addr(T2QSendSyncTrans) = nil) then
   begin
      Result:= 0;
      Exit;
   end;
   @T2QSendASyncTrans := GetProcAddress(Result, PWideChar('TRANS2QUIK_SEND_ASYNC_TRANSACTION'));
   if(addr(T2QSendASyncTrans) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QConnect:= GetProcAddress(Result, PWideChar('TRANS2QUIK_CONNECT'));
   if(addr(T2QConnect) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QDisconnect := GetProcAddress(Result, PWideChar('TRANS2QUIK_DISCONNECT'));
   if(addr(T2QDisconnect) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QSetConnStatCB := GetProcAddress(Result, PWideChar('TRANS2QUIK_SET_CONNECTION_STATUS_CALLBACK'));
   if(addr(T2QSetConnStatCB) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QSetTransReplyCB := GetProcAddress(Result, PWideChar('TRANS2QUIK_SET_TRANSACTIONS_REPLY_CALLBACK'));
   if(addr(T2QSetTransReplyCB) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   //-----------
   //  ????????????????????????????
   //------------
   @T2QIsQuikConnected := GetProcAddress(Result, PWideChar('TRANS2QUIK_IS_QUIK_CONNECTED'));
   if(addr(T2QIsQuikConnected) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QIsDllConnected := GetProcAddress(Result, PWideChar('TRANS2QUIK_IS_DLL_CONNECTED'));
   if(addr(T2QIsDllConnected) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QSubscribeOrders := GetProcAddress(Result, PWideChar('TRANS2QUIK_SUBSCRIBE_ORDERS'));
   if(addr(T2QSubscribeOrders) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QUnSubscribeOrders := GetProcAddress(Result, PWideChar('TRANS2QUIK_UNSUBSCRIBE_ORDERS'));
   if(addr(T2QUnSubscribeOrders) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QStartOrders := GetProcAddress(Result, PWideChar('TRANS2QUIK_START_ORDERS'));
   if(addr(T2QStartOrders) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_QTY'));
   if(addr(T2QOrderQty) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderDate := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_DATE'));
   if(addr(T2QOrderDate) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_TIME'));
   if(addr(T2QOrderTime) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderActiveTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_ACTIVATION_TIME'));
   if(addr(T2QOrderActiveTime) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderWithdrawTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_WITHDRAW_TIME'));
   if(addr(T2QOrderWithdrawTime) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderExpiry := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_EXPIRY'));
   if(addr(T2QOrderExpiry) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderAccruedInt := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_ACCRUED_INT'));
   if(addr(T2QOrderAccruedInt) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderYield := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_YIELD'));
   if(addr(T2QOrderYield) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderUid := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_UID'));
   if(addr(T2QOrderUid) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderVisibleQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_VISIBLE_QTY'));
   if(addr(T2QOrderVisibleQty) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderPeriod := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_PERIOD'));
   if(addr(T2QOrderPeriod) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderFileTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_FILETIME'));
   if(addr(T2QOrderFileTime) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderDateTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_DATE_TIME'));
   if(addr(T2QOrderDateTime) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderWithdrawFileTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_WITHDRAW_FILETIME'));
   if(addr(T2QOrderWithdrawFileTime) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderValueEntryType := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_VALUE_ENTRY_TYPE'));
   if(addr(T2QOrderValueEntryType) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderExtdFlags := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_EXTENDED_FLAGS'));
   if(addr(T2QOrderExtdFlags) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderMinQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_MIN_QTY'));
   if(addr(T2QOrderMinQty) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderExecType := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_EXEC_TYPE'));
   if(addr(T2QOrderExecType) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderAwgPrice := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_AWG_PRICE'));
   if(addr(T2QOrderAwgPrice) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderUserId := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_USERID'));
   if(addr(T2QOrderUserId) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderAccaunt := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_ACCOUNT'));
   if(addr(T2QOrderAccaunt) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderBrokerRef := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_BROKERREF'));
   if(addr(T2QOrderBrokerRef) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderClientCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_CLIENT_CODE'));
   if(addr(T2QOrderClientCode) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_FIRMID'));
   if(addr(T2QOrderFirmId) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QOrderRejectReason := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_REJECT_REASON'));
   if(addr(T2QOrderRejectReason) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QSubscribeTrades := GetProcAddress(Result, PWideChar('TRANS2QUIK_SUBSCRIBE_TRADES'));
   if(addr(T2QSubscribeTrades) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QUnSubscribeTrades := GetProcAddress(Result, PWideChar('TRANS2QUIK_UNSUBSCRIBE_TRADES'));
   if(addr(T2QUnSubscribeTrades) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QStartTrades := GetProcAddress(Result, PWideChar('TRANS2QUIK_START_TRADES'));
   if(addr(T2QStartTrades) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeDate := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_DATE'));
   if(addr(T2QTradeDate) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeSettleDate := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_SETTLE_DATE'));
   if(addr(T2QTradeSettleDate) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TIME'));
   if(addr(T2QTradeTime) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeIsMarginal := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_IS_MARGINAL'));
   if(addr(T2QTradeIsMarginal) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeAccruedInt := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_ACCRUED_INT'));
   if(addr(T2QTradeAccruedInt) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeYield := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_YIELD'));
   if(addr(T2QTradeYield) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeTSCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TS_COMMISSION'));
   if(addr(T2QTradeTSCommission) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeClCenterCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TS_COMMISSION'));
   if(addr(T2QTradeClCenterCommission) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeExcCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_EXCHANGE_COMMISSION'));
   if(addr(T2QTradeExcCommission) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeTrSysCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TRADING_SYSTEM_COMMISSION'));
   if(addr(T2QTradeTrSysCommission) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradePrice2 := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_PRICE2'));
   if(addr(T2QTradePrice2) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeRepoRate := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO_RATE'));
   if(addr(T2QTradeRepoRate) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeRepoValue := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO_VALUE'));
   if(addr(T2QTradeRepoValue) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeRepo2Value := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO2_VALUE'));
   if(addr(T2QTradeRepo2Value) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeAccruedInt2 := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_ACCRUED_INT2'));
   if(addr(T2QTradeAccruedInt2) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeRepoTerm := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO_TERM'));
   if(addr(T2QTradeRepoTerm) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeStDiscount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_START_DISCOUNT'));
   if(addr(T2QTradeStDiscount) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeLwDiscount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_LOWER_DISCOUNT'));
   if(addr(T2QTradeLwDiscount) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeUpDiscount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_UPPER_DISCOUNT'));
   if(addr(T2QTradeUpDiscount) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeBlSecur := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_UPPER_DISCOUNT'));
   if(addr(T2QTradeBlSecur) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradePeriod := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_PERIOD'));
   if(addr(T2QTradePeriod) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeKind := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_KIND'));
   if(addr(T2QTradeKind) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeFileName := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_FILETIME'));
   if(addr(T2QTradeFileName) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeDateTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_DATE_TIME'));
   if(addr(T2QTradeDateTime) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeBrCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_BROKER_COMMISSION'));
   if(addr(T2QTradeBrCommission) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeTransId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TRANSID'));
   if(addr(T2QTradeTransId) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeCurrensy := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_CURRENCY'));
   if(addr(T2QTradeCurrensy) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeSettlCurr := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_SETTLE_CURRENCY'));
   if(addr(T2QTradeSettlCurr) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeSettlCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_SETTLE_CODE'));
   if(addr(T2QTradeSettlCode) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeAccount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_ACCOUNT'));
   if(addr(T2QTradeAccount) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeBrRef := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_BROKERREF'));
   if(addr(T2QTradeBrRef) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeClCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_CLIENT_CODE'));
   if(addr(T2QTradeClCode) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeUserId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_USERID'));
   if(addr(T2QTradeUserId) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_FIRMID'));
   if(addr(T2QTradeFirmId) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradePartFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_PARTNER_FIRMID'));
   if(addr(T2QTradePartFirmId) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeExcCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_EXCHANGE_CODE'));
   if(addr(T2QTradeExcCode) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTradeStationId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_STATION_ID'));
   if(addr(T2QTradeStationId) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyClassCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_CLASS_CODE'));
   if(addr(T2QTransReplyClassCode) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplySecCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_SEC_CODE'));
   if(addr(T2QTransReplySecCode) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyPrice := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_PRICE'));
   if(addr(T2QTransReplyPrice) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_QUANTITY'));
   if(addr(T2QTransReplyQty) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyBal := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_BALANCE'));
   if(addr(T2QTransReplyBal) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_FIRMID'));
   if(addr(T2QTransReplyFirmId) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyAccount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_ACCOUNT'));
   if(addr(T2QTransReplyAccount) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyClCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_CLIENT_CODE'));
   if(addr(T2QTransReplyClCode) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyBrRef := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_BROKERREF'));
   if(addr(T2QTransReplyBrRef) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
   @T2QTransReplyExcCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_EXCHANGE_CODE'));
   if(addr(T2QTransReplyExcCode) = nil) then
   begin
     Result:= 0;
     Exit;
   end;
 end;
end;

//--- Connection status Call Back ---------
procedure pfConnStatusCB;
begin
 //
end;

//--- Transaction callback -----
procedure pfTransReplyCB;
begin
 //
end;

//--- Order status callback -----
procedure pfOrderStatusCB;
begin
//
end;

//--- Trade status callback -----
procedure pfTradeStatusCB;
begin
 //not used
end;

end.
 
Михаил, добрый день.

Попытался использовать Ваш unit tr2quik; (Delphi XE8, trans2quik 1.3)

T2QConnect успешно, а при вызове функции T2QSendSyncTrans получаю Exception class $C0000005 with message 'c0000005 ACCESS_VIOLATION'.
Подскажите, с какими параметрами (и типами переменных) Вы вызываете функцию?

Может быть, есть идеи, от чего ошибка может возникать?

var
 ErrCode, pnRC: long;
 ErrMsg: LPSTR;
 ErrMsgSize, dwRMS: Dword;
 RM: PAnsiChar;
 pdwTI: PDWORD;
 pdON: UInt64;
 res: integer;
begin
 ErrCode:=0;
 ErrMsg:=nil;
 ErrMsgSize:=0;
 pnRC:=0;
 RM:=nil;
 dwRMS:=0;
 pdwTI:=nil;
 pdON:=0;
 res:=T2QSendSyncTrans(LPSTR(AnsiString('TRANS_ID=1;CLASSCODE=BQND;ACTION=Ввод заявки;Код торгового счета=L01-00000F00;К/П=Купля;Тип=Лимитированная;Режим=BQND;Инструмент=RU000A0ZYYN4;Цена=90.000000;Количество=20;Примечание=;Условие исполнения=Поставить в очередь;')), pnRC, pdwTI, pdON, RM, dwRMS, ErrCode, ErrMsg, ErrMsgSize);
 
Цитата
Павел написал:
Михаил, добрый день.

Попытался использовать Ваш unit tr2quik; (Delphi XE8, trans2quik 1.3)

T2QConnect успешно, а при вызове функции T2QSendSyncTrans получаю Exception class $C0000005 with message 'c0000005 ACCESS_VIOLATION'.
Подскажите, с какими параметрами (и типами переменных) Вы вызываете функцию?

Может быть, есть идеи, от чего ошибка может возникать?

var
 ErrCode, pnRC: long;
 ErrMsg: LPSTR;
 ErrMsgSize, dwRMS: Dword;
 RM: PAnsiChar;
 pdwTI: PDWORD;
 pdON: UInt64;
 res: integer;
begin
 ErrCode:=0;
 ErrMsg:=nil;
 ErrMsgSize:=0;
 pnRC:=0;
 RM:=nil;
 dwRMS:=0;
 pdwTI:=nil;
 pdON:=0;
 res:=T2QSendSyncTrans(LPSTR(AnsiString('TRANS_ID=1;CLASSCODE=BQND;ACTION=Ввод заявки;Код торгового счета=L01-00000F00;К/П=Купля;Тип=Лимитированная;Режим=BQND;Инструмент=RU000A0ZYYN4;Цена=90.000000;Количество=20;Примечание=;Условие исполнения=Поставить в очередь;')), pnRC, pdwTI, pdON, RM, dwRMS, ErrCode, ErrMsg, ErrMsgSize);
//............................................
   else begin
     outStr:= 'ACCOUNT=' + ExpData.SpotAccaunt + '; CLIENT_CODE=' +
              ExpData.Client + '; TYPE=L; TRANS_ID=' + id +
              '; CLASSCODE=' + ExpData.SpotData.ClassCode + '; SECCODE=' +
              ExpData.SpotData.SecCode +
              '; ACTION=NEW_ORDER; OPERATION=B' + '; PRICE=' +
              FloatToStr(ExpData.SpotData.SellPrice + 10 * ExpData.SpotData.Step) +
              '; QUANTITY=' + FloatToStr(MustSpotVol) + ';';
   end;
 end;
 ErrCode:= 0;
 ErrSize:= 0;
 ErrStr:= nil;
 res:= T2QSendASyncTrans(LPSTR(AnsiString(outStr)), ErrCode, ErrStr, ErrSize);
 if(res <> TRANS2QUIK_SUCCESS) then
 begin
   FTransID:= 0;
   FTransBusy:= false;
 end else
 begin
   Dt:= now();
   FMemo.Lines.Add(DateToStr(Dt) + ' ' + FormatDateTime('hh:mm:ss.zzz', Now()) +
                   ' --> Ордер ' + ExpData.SpotData.SecCode + ' отправлен.');
 end;
 
Только я использую асинхронные транзакции
Страницы: 1
Читают тему
Наверх