:: Visual Foxpro, Foxpro for DOS
Конвертация кода
w3d
Автор

Сообщений: 129
Откуда: Курганская обл.
Дата регистрации: 09.02.2005
Есть такой код на Дельфи:
begin
wstLocation := '';
BOMat.Select(TRUE, // true - модальное окно выбора обьекта, false - не модальное.
wstLocation, // Location обьекта
Handle); // указатель окна МиС
BOMat.GetObjectInfo( wstLocation, ClassID, ObjectID );// запрос "Получить информацию об обьете"
BOMat.Request.Topic := topicProperties; // Заголовок запроса (см. BOMatConst)
BOMat.Request.Attribute[ anAction ].AsString := avGet; //Атрибут запроса на получение свойств (см. BOMatConst)
BOMat.Request.Attribute[ anClassID ].AsString := ClassID; // Атрибут запроса ClassID
BOMat.Request.Attribute[ anObjectID ].AsString := ObjectID; // Атрибут запроса ObjectID
BOMat.ExecuteRequest;
edSelectedObject.Text := BOMat.Response.Item[0].DisplayName + ' класса ' +
BOMat.Response.Item[0].ClassID;
_ParseObjects( BOMat.Response, nil); // Парсим полученную коллекцию обьектов и атрибутов.
end;

Никак не могу сообразить, как переписать конструкцию

BOMat.Request.Attribute[ anAction ].AsString := avGet;

на Фоксе?
Ratings: 0 negative/0 positive
Re: Конвертация кода
ghost

Сообщений: 324
Дата регистрации: 22.03.2005
.AsТип - приведение типов.
при "переписи конструкции" приведите тип "avGet" в к типу "Attribute[ anAction ]"
Ratings: 0 negative/0 positive
Re: Конвертация кода
w3d
Автор

Сообщений: 129
Откуда: Курганская обл.
Дата регистрации: 09.02.2005
Прокатила такая конструкция:
BOMat.Request.Attribute(anAction).value = avGet
Ratings: 0 negative/0 positive
Re: Конвертация кода
w3d
Автор

Сообщений: 129
Откуда: Курганская обл.
Дата регистрации: 09.02.2005
-----------------------------------------------------------------------------------------------------------------------------------
Фокс (VFP9):
BOMat = CREATEOBJECT('Materials.BOSimpleProvider')
wstLocation = ''
ClassID=''
ObjectID=''
TRUE=.t.
BOMat.Select(.t., wstLocation, thisform.HWnd)

Здесь вылетает ошибка: "Access violation at adress 00404BE8 in module 'Materials.exe'. Write
of adress 0000083C"

В дельфи это проходит нормально:
begin
wstLocation := '';
BOMat.Select(TRUE, // true - модальное окно выбора обьекта, false - не модальное.
wstLocation, // Location обьекта
Handle);
Ratings: 0 negative/0 positive
Re: Конвертация кода
w3d
Автор

Сообщений: 129
Откуда: Курганская обл.
Дата регистрации: 09.02.2005
Забыл вопрос написать: почему так происходит?
Ratings: 0 negative/0 positive
Re: Конвертация кода
Влад Колосов

Сообщений: 22664
Откуда: Ростов-на-Дону
Дата регистрации: 05.05.2005
по-моему в объекте проблема, передача параметров и создание правильное.
Ratings: 0 negative/0 positive
Re: Конвертация кода
w3d
Автор

Сообщений: 129
Откуда: Курганская обл.
Дата регистрации: 09.02.2005
Разнес создание объекта и получение информации на разные кнопки - заработало (ничего не понимаю!)
Но вылез другой глюк:
BOMat.Select(TRUE, wstLocation, Handle);
в дельфях возвращает wstLocation, а в фоксе - нет ((
Соответственно и
BOMat.GetObjectInfo( wstLocation, ClassID, ObjectID )
в дельфях возвращает ClassID, ObjectID, а в фоксе - нет
В чем может быть дело?

Код фокса:
tt=BOMat.Select(.t., wstLocation, thisform.HWnd)
*wstLocation = "0^Material:V6828A2648E054231864177694ED58D3C"
tt=BOMat.GetObjectInfo(wstLocation,ClassID,ObjectID)
*ClassID='Material'
*ObjectID='V6828A2648E054231864177694ED58D3C'
BOMat.Request.Topic = topicProperties
BOMat.Request.Attribute(anAction).value = avGet
BOMat.Request.Attribute(anClassID).value = ClassID
BOMat.Request.Attribute(anObjectID).value = ObjectID
BOMat.ExecuteRequest
thisform.Label1.Caption = BOMat.Response.Item(0).DisplayName + ' класса ' + BOMat.Response.Item[0].ClassID
Если раскомментировать, то запрос отрабатывает нормально и BOMat.Response.Item(0).DisplayName получает значение.
Ratings: 0 negative/0 positive
Re: Конвертация кода
Влад Колосов

Сообщений: 22664
Откуда: Ростов-на-Дону
Дата регистрации: 05.05.2005
Если объявить переменные PUBLIC и объект оперирует внутри себя теми же именами, то должен возвращать значения (точнее, их изменять).
Метод может вернуть только одно значение.
Ratings: 0 negative/0 positive
Re: Конвертация кода
w3d
Автор

Сообщений: 129
Откуда: Курганская обл.
Дата регистрации: 09.02.2005
Объявил wstLocation Public, но все равно
BOMat.Select(.t., wstLocation, thisform.HWnd)
возвращает wstLocation - пустое значение
В дельфи
BOMat.Select(TRUE, wstLocation, Handle)
возвращает wstLocation значение
Ratings: 0 negative/0 positive
Re: Конвертация кода
Влад Колосов

Сообщений: 22664
Откуда: Ростов-на-Дону
Дата регистрации: 05.05.2005
а что за класс?
Ratings: 0 negative/0 positive
Re: Конвертация кода
w3d
Автор

Сообщений: 129
Откуда: Курганская обл.
Дата регистрации: 09.02.2005
Я в дельфях не силен, не знаю.
Вот целиком код (во вложении)
Ratings: 0 negative/0 positive
Re: Конвертация кода
w3d
Автор

Сообщений: 129
Откуда: Курганская обл.
Дата регистрации: 09.02.2005
Почему-то выдало ошибку
Здесь код поставлю:
unit UExampleAPI;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, Buttons, DB, DBTables, Grids, AppEvnts, StrUtils,
ExtCtrls, CheckLst, Menus, ImgList, Registry, BOSimple_TLB;
type
TfrmExampleMain = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
btnConnect: TButton;
Panel3: TPanel;
btnExit: TButton;
btnSelectObject: TButton;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
edSelectedObject: TEdit;
Label1: TLabel;
labState: TLabel;
tvProperties: TTreeView;
//------------------------------------------------------------------------------
procedure _ParseObjects( OC : IBOObjectCollection; tnObjectNode : TTreeNode );
procedure _ParseAttributes( AC : IBOAttributeCollection; tnObjectNode : TTreeNode);
function _AddNode(stMessage: string; tnParentNode : TTreeNode) : TTreeNode;
//------------------------------------------------------------------------------
procedure btnConnectClick(Sender: TObject);
procedure btnExitClick(Sender: TObject);
procedure btnSelectObjectClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmExampleMain: TfrmExampleMain;
implementation
uses
URSMessages, Materials_TLB, BOMatConst, ComObj;
var
BOMat : IBOSimpleProvider;
wstLocation : WideString;
{$R *.dfm}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function TfrmExampleMain._AddNode(stMessage: string; tnParentNode : TTreeNode) : TTreeNode;
begin
result := tvProperties.Items.AddChild(tnParentNode, stMessage);
end;
//------------------------------------------------------------------------------
// Парсим полученную коллекцию обьектов
procedure TfrmExampleMain._ParseObjects( OC : IBOObjectCollection; tnObjectNode : TTreeNode );
var
i : integer;
O : IBOObject;
tnNode, tnAttributes : TTreeNode;
begin
for i:=0 to OC.Count-1 do begin
O := OC.Item[i];
tnNode := _AddNode( Format('Объект "%s" класса %s', [O.ObjectID, O.ClassID] ), tnObjectNode);
_AddNode( Format('DisplayName = "%s"', [ O.DisplayName ] ), tnNode);
if O.Attributes.Count > 0 then
begin
tnAttributes := _AddNode( 'Атрибуты', tnNode);
_ParseAttributes( O.Attributes, tnAttributes);
end;
_ParseObjects( O.Objects, tnNode );
end;
end;
//------------------------------------------------------------------------------
// Парсим полученную коллекцию атрибутов
procedure TfrmExampleMain._ParseAttributes( AC : IBOAttributeCollection; tnObjectNode : TTreeNode );
var
i : integer;
A : IBOAttribute;
tnChildNode : TTreeNode;
begin
for i:=0 to AC.Count-1 do
begin
A := AC.Item[i];
tnChildNode := _AddNode( Format( 'Name ="%s" Value = "%s"', [ A.Name, A.Value ] ),tnObjectNode);
_ParseAttributes( A.Attributes, tnChildNode);
end;
end;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
procedure TfrmExampleMain.btnConnectClick(Sender: TObject);
begin
if not Assigned( BOMat ) then begin
try
BOMat := CreateComObject(Class_BOSimpleProvider) as IBOSimpleProvider;// создаём COM обьект, подключаемся к МиС
btnConnect.Caption := rs_Capt_Disconnect;
btnSelectObject.Enabled := true;
labState.Caption := rs_COM_Connected;
except
on E:Exception do
begin
ShowMessage(E.Message + #10'Не могу инициализировать "Materials.BOSimpleProvider"');
btnConnect.Caption := rs_Capt_Connect;
btnSelectObject.Enabled := false;
labState.Caption := rs_COM_DisConnected;
end;
end;
end
else begin
BOMat := nil; // отключаемся от МиС
btnConnect.Caption := rs_Capt_Connect;
btnSelectObject.Enabled := false;
labState.Caption := rs_COM_DisConnected;
end;
wstLocation := '';
end;
procedure TfrmExampleMain.btnExitClick(Sender: TObject);
begin
frmExampleMain.Close;
end;
procedure TfrmExampleMain.btnSelectObjectClick(Sender: TObject);
var
ClassID, ObjectID : WideString;
begin
wstLocation := '';
BOMat.Select(TRUE, // true - модальное окно выбора обьекта, false - не модальное.
wstLocation, // Location обьекта
Handle); // указатель окна МиС
BOMat.GetObjectInfo( wstLocation, ClassID, ObjectID );// запрос "Получить информацию об обьете"
BOMat.Request.Topic := topicProperties; // Заголовок запроса (см. BOMatConst)
BOMat.Request.Attribute[ anAction ].AsString := avGet; //Атрибут запроса на получение свойств (см. BOMatConst)
BOMat.Request.Attribute[ anClassID ].AsString := ClassID; // Атрибут запроса ClassID
BOMat.Request.Attribute[ anObjectID ].AsString := ObjectID; // Атрибут запроса ObjectID
BOMat.ExecuteRequest;
edSelectedObject.Text := BOMat.Response.Item[0].DisplayName + ' класса ' +
BOMat.Response.Item[0].ClassID;
_ParseObjects( BOMat.Response, nil); // Парсим полученную коллекцию обьектов и атрибутов.
end;
end.
Ratings: 0 negative/0 positive
Re: Конвертация кода
Влад Колосов

Сообщений: 22664
Откуда: Ростов-на-Дону
Дата регистрации: 05.05.2005
Примерно понятно, но должна же быть библиотека, в которой существует класс IBOSimpleProvider, OLE модуль Materials.
В этом тексте нет определения для IBOSimpleProvider.

Что это за приложение? В нем нужно совершить какие-то действия?
Ratings: 0 negative/0 positive
Re: Конвертация кода
w3d
Автор

Сообщений: 129
Откуда: Курганская обл.
Дата регистрации: 09.02.2005
Описание проблемы: www.sql.ru

Вот еще что есть:

unit BOSimple_TLB;

// ************************************************************************ //
// WARNING
// -------
// The types declared in this file were generated from data read from a
// Type Library. If this type library is explicitly or indirectly (via
// another type library referring to this type library) re-imported, or the
// 'Refresh' command of the Type Library Editor activated while editing the
// Type Library, the contents of this file will be regenerated and all
// manual modifications will be lost.
// ************************************************************************ //

// PASTLWTR : 1.2
// File generated on 17.03.2004 10:46:50 from Type Library described below.

// ************************************************************************ //
// Type Lib: D:\YGL\System\BOSimple.tlb (1)
// LIBID: {45276A6A-6A03-4BC0-B984-FB84C70BBCCF}
// LCID: 0
// Helpfile:
// HelpString: BOSimple Library
// DepndLst:
// (1) v2.0 stdole, (C:\WINNT\System32\stdole2.tlb)
// ************************************************************************ //
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers.
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
//{$VARPROPSETTER ON}
interface

uses Windows, ActiveX, Classes, Graphics, OleCtrls, StdVCL, Variants;


// *********************************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:
// Type Libraries : LIBID_xxxx
// CoClasses : CLASS_xxxx
// DISPInterfaces : DIID_xxxx
// Non-DISP interfaces: IID_xxxx
// *********************************************************************//
const
// TypeLibrary Major and minor versions
BOSimpleMajorVersion = 1;
BOSimpleMinorVersion = 0;

LIBID_BOSimple: TGUID = '{45276A6A-6A03-4BC0-B984-FB84C70BBCCF}';

IID_IBOItem: TGUID = '{16D42597-F51E-46F8-A9D1-98D040DA5ED3}';
IID_IBOObject: TGUID = '{85299E3F-6D6B-430B-9CBE-72F28E128D0E}';
IID_IBOAttribute: TGUID = '{F262BEE6-DAA8-4EAB-958F-589253F8D3B3}';
IID_IBOItemCollection: TGUID = '{231BE669-E7A5-4194-81B1-12F439570297}';
IID_IBOAttributeCollection: TGUID = '{FE05BB59-5F48-435D-8B21-705CA58C0EE3}';
IID_IBOObjectCollection: TGUID = '{3B531410-3836-4243-B3A2-9D60026BAFF3}';
IID_IBORequest: TGUID = '{8FA91A6F-C560-452D-AF37-F1EA3456E961}';
IID_IBOResponse: TGUID = '{97AF12CB-8FF5-4DAF-94D0-2D9A65F64DE3}';
IID_IBOSimpleProvider: TGUID = '{B57C3F55-8C78-437F-AEFD-911FC1A3617A}';
CLASS_BOObject: TGUID = '{4EB0DA4A-17FF-47E1-BCAD-93535DF25448}';
CLASS_BOAttribute: TGUID = '{9E8FF4B2-B300-472B-A492-595C7F0A9B71}';
CLASS_BOObjectCollection: TGUID = '{2400090C-1C41-45C0-82FA-41220EC1AAEF}';
CLASS_BOAttributeCollection: TGUID = '{DC8083FF-C2F9-4395-BF6E-AB9F3D234DF2}';
CLASS_BORequest: TGUID = '{188D189D-4ED7-404B-8DC4-F458B6F65076}';
CLASS_BOResponse: TGUID = '{79059E91-42F5-4DD0-9A37-7BFC95C2E823}';
IID_IBOKernel: TGUID = '{03F6492D-5155-4CF2-A372-65DD1403458B}';
CLASS_BOKernel: TGUID = '{FE0C0722-1E0C-4174-A9BF-F637B7EF1244}';
type

// *********************************************************************//
// Forward declaration of types defined in TypeLibrary
// *********************************************************************//
IBOItem = interface;
IBOItemDisp = dispinterface;
IBOObject = interface;
IBOObjectDisp = dispinterface;
IBOAttribute = interface;
IBOAttributeDisp = dispinterface;
IBOItemCollection = interface;
IBOItemCollectionDisp = dispinterface;
IBOAttributeCollection = interface;
IBOAttributeCollectionDisp = dispinterface;
IBOObjectCollection = interface;
IBOObjectCollectionDisp = dispinterface;
IBORequest = interface;
IBORequestDisp = dispinterface;
IBOResponse = interface;
IBOResponseDisp = dispinterface;
IBOSimpleProvider = interface;
IBOSimpleProviderDisp = dispinterface;
IBOKernel = interface;
IBOKernelDisp = dispinterface;

// *********************************************************************//
// Declaration of CoClasses defined in Type Library
// (NOTE: Here we map each CoClass to its Default Interface)
// *********************************************************************//
BOObject = IBOObject;
BOAttribute = IBOAttribute;
BOObjectCollection = IBOObjectCollection;
BOAttributeCollection = IBOAttributeCollection;
BORequest = IBORequest;
BOResponse = IBOResponse;
BOKernel = IBOKernel;


// *********************************************************************//
// Interface: IBOItem
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {16D42597-F51E-46F8-A9D1-98D040DA5ED3}
// *********************************************************************//
IBOItem = interface(IDispatch)
['{16D42597-F51E-46F8-A9D1-98D040DA5ED3}']
function Get_XML: WideString; safecall;
property XML: WideString read Get_XML;
end;

// *********************************************************************//
// DispIntf: IBOItemDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {16D42597-F51E-46F8-A9D1-98D040DA5ED3}
// *********************************************************************//
IBOItemDisp = dispinterface
['{16D42597-F51E-46F8-A9D1-98D040DA5ED3}']
property XML: WideString readonly dispid 1610743808;
end;

// *********************************************************************//
// Interface: IBOObject
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {85299E3F-6D6B-430B-9CBE-72F28E128D0E}
// *********************************************************************//
IBOObject = interface(IBOItem)
['{85299E3F-6D6B-430B-9CBE-72F28E128D0E}']
function Get_Attributes: IBOAttributeCollection; safecall;
function Get_Attribute(const aName: WideString): IBOAttribute; safecall;
function Get_Objects: IBOObjectCollection; safecall;
function Get_ObjectID: WideString; safecall;
procedure Set_ObjectID(const Value: WideString); safecall;
function Get_ClassID: WideString; safecall;
procedure Set_ClassID(const Value: WideString); safecall;
function Get_DisplayName: WideString; safecall;
property Attributes: IBOAttributeCollection read Get_Attributes;
property Attribute[const aName: WideString]: IBOAttribute read Get_Attribute;
property Objects: IBOObjectCollection read Get_Objects;
property ObjectID: WideString read Get_ObjectID write Set_ObjectID;
property ClassID: WideString read Get_ClassID write Set_ClassID;
property DisplayName: WideString read Get_DisplayName;
end;

// *********************************************************************//
// DispIntf: IBOObjectDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {85299E3F-6D6B-430B-9CBE-72F28E128D0E}
// *********************************************************************//
IBOObjectDisp = dispinterface
['{85299E3F-6D6B-430B-9CBE-72F28E128D0E}']
property Attributes: IBOAttributeCollection readonly dispid 5;
property Attribute[const aName: WideString]: IBOAttribute readonly dispid 6;
property Objects: IBOObjectCollection readonly dispid 4;
property ObjectID: WideString dispid 1;
property ClassID: WideString dispid 3;
property DisplayName: WideString readonly dispid 2;
property XML: WideString readonly dispid 1610743808;
end;

// *********************************************************************//
// Interface: IBOAttribute
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {F262BEE6-DAA8-4EAB-958F-589253F8D3B3}
// *********************************************************************//
IBOAttribute = interface(IBOItem)
['{F262BEE6-DAA8-4EAB-958F-589253F8D3B3}']
function Get_Name: WideString; safecall;
function Get_Value: WideString; safecall;
procedure Set_Value(const Value: WideString); safecall;
function Get_AsString: WideString; safecall;
procedure Set_AsString(const Value: WideString); safecall;
function Get_AsFloat: Double; safecall;
procedure Set_AsFloat(Value: Double); safecall;
function Get_AsInteger: Integer; safecall;
procedure Set_AsInteger(Value: Integer); safecall;
function Get_AsBoolean: WordBool; safecall;
procedure Set_AsBoolean(Value: WordBool); safecall;
function Get_Attributes: IBOAttributeCollection; safecall;
function Get_Attribute(const aName: WideString): IBOAttribute; safecall;
property Name: WideString read Get_Name;
property Value: WideString read Get_Value write Set_Value;
property AsString: WideString read Get_AsString write Set_AsString;
property AsFloat: Double read Get_AsFloat write Set_AsFloat;
property AsInteger: Integer read Get_AsInteger write Set_AsInteger;
property AsBoolean: WordBool read Get_AsBoolean write Set_AsBoolean;
property Attributes: IBOAttributeCollection read Get_Attributes;
property Attribute[const aName: WideString]: IBOAttribute read Get_Attribute;
end;

// *********************************************************************//
// DispIntf: IBOAttributeDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {F262BEE6-DAA8-4EAB-958F-589253F8D3B3}
// *********************************************************************//
IBOAttributeDisp = dispinterface
['{F262BEE6-DAA8-4EAB-958F-589253F8D3B3}']
property Name: WideString readonly dispid 1;
property Value: WideString dispid 2;
property AsString: WideString dispid 4;
property AsFloat: Double dispid 5;
property AsInteger: Integer dispid 6;
property AsBoolean: WordBool dispid 7;
property Attributes: IBOAttributeCollection readonly dispid 3;
property Attribute[const aName: WideString]: IBOAttribute readonly dispid 8;
property XML: WideString readonly dispid 1610743808;
end;

// *********************************************************************//
// Interface: IBOItemCollection
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {231BE669-E7A5-4194-81B1-12F439570297}
// *********************************************************************//
IBOItemCollection = interface(IDispatch)
['{231BE669-E7A5-4194-81B1-12F439570297}']
function Get_Count: Integer; safecall;
function Get_XML: WideString; safecall;
procedure Clear; safecall;
procedure Delete(Index: Integer); safecall;
property Count: Integer read Get_Count;
property XML: WideString read Get_XML;
end;

// *********************************************************************//
// DispIntf: IBOItemCollectionDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {231BE669-E7A5-4194-81B1-12F439570297}
// *********************************************************************//
IBOItemCollectionDisp = dispinterface
['{231BE669-E7A5-4194-81B1-12F439570297}']
property Count: Integer readonly dispid 1;
property XML: WideString readonly dispid 4;
procedure Clear; dispid 200;
procedure Delete(Index: Integer); dispid 205;
end;

// *********************************************************************//
// Interface: IBOAttributeCollection
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {FE05BB59-5F48-435D-8B21-705CA58C0EE3}
// *********************************************************************//
IBOAttributeCollection = interface(IBOItemCollection)
['{FE05BB59-5F48-435D-8B21-705CA58C0EE3}']
function Get_Item(Index: Integer): IBOAttribute; safecall;
function Get_Attribute(const aName: WideString): IBOAttribute; safecall;
function Add(const aName: WideString; const aValue: WideString): IBOAttribute; safecall;
function Get_Value(const aName: WideString): WideString; safecall;
procedure Set_Value(const aName: WideString; const Value: WideString); safecall;
function Get_AutoAppend: WordBool; safecall;
procedure Set_AutoAppend(Value: WordBool); safecall;
function Get_Duplicates: WordBool; safecall;
procedure Set_Duplicates(Value: WordBool); safecall;
property Item[Index: Integer]: IBOAttribute read Get_Item;
property Attribute[const aName: WideString]: IBOAttribute read Get_Attribute;
property Value[const aName: WideString]: WideString read Get_Value write Set_Value;
property AutoAppend: WordBool read Get_AutoAppend write Set_AutoAppend;
property Duplicates: WordBool read Get_Duplicates write Set_Duplicates;
end;

// *********************************************************************//
// DispIntf: IBOAttributeCollectionDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {FE05BB59-5F48-435D-8B21-705CA58C0EE3}
// *********************************************************************//
IBOAttributeCollectionDisp = dispinterface
['{FE05BB59-5F48-435D-8B21-705CA58C0EE3}']
property Item[Index: Integer]: IBOAttribute readonly dispid 3;
property Attribute[const aName: WideString]: IBOAttribute readonly dispid 2;
function Add(const aName: WideString; const aValue: WideString): IBOAttribute; dispid 201;
property Value[const aName: WideString]: WideString dispid 5;
property AutoAppend: WordBool dispid 7;
property Duplicates: WordBool dispid 6;
property Count: Integer readonly dispid 1;
property XML: WideString readonly dispid 4;
procedure Clear; dispid 200;
procedure Delete(Index: Integer); dispid 205;
end;

// *********************************************************************//
// Interface: IBOObjectCollection
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {3B531410-3836-4243-B3A2-9D60026BAFF3}
// *********************************************************************//
IBOObjectCollection = interface(IBOItemCollection)
['{3B531410-3836-4243-B3A2-9D60026BAFF3}']
function Get_Item(Index: Integer): IBOObject; safecall;
function Add(const aClassID: WideString; const aObjectID: WideString;
const aDisplayName: WideString): IBOObject; safecall;
property Item[Index: Integer]: IBOObject read Get_Item;
end;

// *********************************************************************//
// DispIntf: IBOObjectCollectionDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {3B531410-3836-4243-B3A2-9D60026BAFF3}
// *********************************************************************//
IBOObjectCollectionDisp = dispinterface
['{3B531410-3836-4243-B3A2-9D60026BAFF3}']
property Item[Index: Integer]: IBOObject readonly dispid 3;
function Add(const aClassID: WideString; const aObjectID: WideString;
const aDisplayName: WideString): IBOObject; dispid 6;
property Count: Integer readonly dispid 1;
property XML: WideString readonly dispid 4;
procedure Clear; dispid 200;
procedure Delete(Index: Integer); dispid 205;
end;

// *********************************************************************//
// Interface: IBORequest
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {8FA91A6F-C560-452D-AF37-F1EA3456E961}
// *********************************************************************//
IBORequest = interface(IDispatch)
['{8FA91A6F-C560-452D-AF37-F1EA3456E961}']
function Get_Attributes: IBOAttributeCollection; safecall;
function Get_Topic: WideString; safecall;
procedure Set_Topic(const Value: WideString); safecall;
function Get_Attribute(const aName: WideString): IBOAttribute; safecall;
function Get_XML: WideString; safecall;
function Get_Objects: IBOObjectCollection; safecall;
property Attributes: IBOAttributeCollection read Get_Attributes;
property Topic: WideString read Get_Topic write Set_Topic;
property Attribute[const aName: WideString]: IBOAttribute read Get_Attribute;
property XML: WideString read Get_XML;
property Objects: IBOObjectCollection read Get_Objects;
end;

// *********************************************************************//
// DispIntf: IBORequestDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {8FA91A6F-C560-452D-AF37-F1EA3456E961}
// *********************************************************************//
IBORequestDisp = dispinterface
['{8FA91A6F-C560-452D-AF37-F1EA3456E961}']
property Attributes: IBOAttributeCollection readonly dispid 1;
property Topic: WideString dispid 2;
property Attribute[const aName: WideString]: IBOAttribute readonly dispid 5;
property XML: WideString readonly dispid 4;
property Objects: IBOObjectCollection readonly dispid 3;
end;

// *********************************************************************//
// Interface: IBOResponse
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {97AF12CB-8FF5-4DAF-94D0-2D9A65F64DE3}
// *********************************************************************//
IBOResponse = interface(IBOObjectCollection)
['{97AF12CB-8FF5-4DAF-94D0-2D9A65F64DE3}']
function Get_Attributes: IBOAttributeCollection; safecall;
procedure SetError(ACode: Integer; const AMsg: WideString); safecall;
property Attributes: IBOAttributeCollection read Get_Attributes;
end;

// *********************************************************************//
// DispIntf: IBOResponseDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {97AF12CB-8FF5-4DAF-94D0-2D9A65F64DE3}
// *********************************************************************//
IBOResponseDisp = dispinterface
['{97AF12CB-8FF5-4DAF-94D0-2D9A65F64DE3}']
property Attributes: IBOAttributeCollection readonly dispid 2;
procedure SetError(ACode: Integer; const AMsg: WideString); dispid 5;
property Item[Index: Integer]: IBOObject readonly dispid 3;
function Add(const aClassID: WideString; const aObjectID: WideString;
const aDisplayName: WideString): IBOObject; dispid 6;
property Count: Integer readonly dispid 1;
property XML: WideString readonly dispid 4;
procedure Clear; dispid 200;
procedure Delete(Index: Integer); dispid 205;
end;

// *********************************************************************//
// Interface: IBOSimpleProvider
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {B57C3F55-8C78-437F-AEFD-911FC1A3617A}
// *********************************************************************//
IBOSimpleProvider = interface(IDispatch)
['{B57C3F55-8C78-437F-AEFD-911FC1A3617A}']
function Get_Request: IBORequest; safecall;
procedure Refresh; safecall;
function Get_SourceID: WideString; safecall;
procedure ExecuteRequest; safecall;
function Get_Response: IBOResponse; safecall;
function GetObject(const ClassID: WideString; const ObjectID: WideString; Options: Integer): IBOObject; safecall;
function GetObjects(const ClassID: WideString; Options: Integer): IBOObjectCollection; safecall;
function Select(Modal: WordBool; var Location: WideString; ClientWindow: Integer): WordBool; safecall;
procedure GetObjectInfo(const Location: WideString; var ClassID: WideString;
var ObjectID: WideString); safecall;
procedure RegisterClient(const aName: WideString); safecall;
procedure UnRegisterClient; safecall;
function Get_ClientID: Integer; safecall;
function Get_Status: Integer; safecall;
property Request: IBORequest read Get_Request;
property SourceID: WideString read Get_SourceID;
property Response: IBOResponse read Get_Response;
property ClientID: Integer read Get_ClientID;
property Status: Integer read Get_Status;
end;

// *********************************************************************//
// DispIntf: IBOSimpleProviderDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {B57C3F55-8C78-437F-AEFD-911FC1A3617A}
// *********************************************************************//
IBOSimpleProviderDisp = dispinterface
['{B57C3F55-8C78-437F-AEFD-911FC1A3617A}']
property Request: IBORequest readonly dispid 9;
procedure Refresh; dispid 1;
property SourceID: WideString readonly dispid 2;
procedure ExecuteRequest; dispid 3;
property Response: IBOResponse readonly dispid 4;
function GetObject(const ClassID: WideString; const ObjectID: WideString; Options: Integer): IBOObject; dispid 5;
function GetObjects(const ClassID: WideString; Options: Integer): IBOObjectCollection; dispid 6;
function Select(Modal: WordBool; var Location: WideString; ClientWindow: Integer): WordBool; dispid 8;
procedure GetObjectInfo(const Location: WideString; var ClassID: WideString;
var ObjectID: WideString); dispid 10;
procedure RegisterClient(const aName: WideString); dispid 11;
procedure UnRegisterClient; dispid 12;
property ClientID: Integer readonly dispid 13;
property Status: Integer readonly dispid 7;
end;

// *********************************************************************//
// Interface: IBOKernel
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {03F6492D-5155-4CF2-A372-65DD1403458B}
// *********************************************************************//
IBOKernel = interface(IDispatch)
['{03F6492D-5155-4CF2-A372-65DD1403458B}']
procedure Refresh; safecall;
function Get_Count: Integer; safecall;
procedure Set_Count(Value: Integer); safecall;
function ExternalResponse(const SourceID: WideString; Engine: Integer;
const Request: IBORequest; const Response: IBOResponse): WordBool; safecall;
property Count: Integer read Get_Count write Set_Count;
end;

// *********************************************************************//
// DispIntf: IBOKernelDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {03F6492D-5155-4CF2-A372-65DD1403458B}
// *********************************************************************//
IBOKernelDisp = dispinterface
['{03F6492D-5155-4CF2-A372-65DD1403458B}']
procedure Refresh; dispid 1;
property Count: Integer dispid 3;
function ExternalResponse(const SourceID: WideString; Engine: Integer;
const Request: IBORequest; const Response: IBOResponse): WordBool; dispid 4;
end;

implementation

uses ComObj;

end.
Ratings: 0 negative/0 positive
Re: Конвертация кода
Петров Андрей

Сообщений: 2506
Откуда: Химки (М.О.)
Дата регистрации: 17.04.2002
Цитата:
function Select(Modal: WordBool; var Location: WideString; ClientWindow: Integer): WordBool; safecall

1) WideString - Не PChar.
2) SafeCall - Не StdCall.
3) Строку по ссылке передавайте те Select(True, @Str, HWND)
4) WordBool - судя по типу это 2 байта а не 4. Ставьте тип Short вместо Integer.

ИМХО нужна своя промежуточная DLL...




------------------
PS Недочитал тему до конца...
Ratings: 0 negative/0 positive
Re: Конвертация кода
w3d
Автор

Сообщений: 129
Откуда: Курганская обл.
Дата регистрации: 09.02.2005
Петров Андрей писал(а):
Цитата:
Цитата:
function Select(Modal: WordBool; var Location: WideString; ClientWindow: Integer): WordBool; safecall

1) WideString - Не PChar.
2) SafeCall - Не StdCall.
3) Строку по ссылке передавайте те Select(True, @Str, HWND)
4) WordBool - судя по типу это 2 байта а не 4. Ставьте тип Short вместо Integer.

ИМХО нужна своя промежуточная DLL...


ОГРОМНОЕ СПАСИБО!
Передача по ссылке помогла, все заработало
Ratings: 0 negative/0 positive


Извините, только зарегистрированные пользователи могут оставлять сообщения в этом форуме.

On-line: 50 (Гостей: 50)

© 2000-2024 Fox Club 
Яндекс.Метрика