powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / FoxPro, Visual FoxPro [игнор отключен] [закрыт для гостей] / создать dll фоксе и использовать в delphi
4 сообщений из 4, страница 1 из 1
создать dll фоксе и использовать в delphi
    #34684611
Доброе время суток умнейшие, у меня возникла необходимость программу на VFP 8 подключить в программу написанную на delphi в виде dll.

тестирую след. программу:

cMyClass = CREATEOBJECT("myClass")
cMyClass.run
RELEASE cMyClass

DEFINE CLASS myClass AS CUSTOM OLEPUBLIC
PROCEDURE run
WAIT WINDOW "Hi"
ENDPROC
ENDDEFINE


в delphi:

type
StandardProc = function(AText: String):Integer;

TForm1 = class(TForm)
procedure FormActivate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
run : StandardProc;
DLLHandle : THandle;
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormActivate(Sender: TObject);
begin
DLLHandle := LoadLibrary(test.dll');
@Run := GetProcAddress(DLLHandle,'run');
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
FreeLibrary(DLLHandle);
end;

dll грузится, вызываю метод run, но ни чего не происходит, где подвох?
...
Рейтинг: 0 / 0
создать dll фоксе и использовать в delphi
    #34684638
Для начала вместо wait window 'Hi' поставь return с возвратом чего-нибудь и посмотри, получает ли твоя прога это возвращаемое значение.
...
Рейтинг: 0 / 0
создать dll фоксе и использовать в delphi
    #34684658
А вот вдогонку кусок хелпа.

In-Process and out-of-process servers provide differing services, especially regarding the user interface of your application.

User Interfaces
Although earlier versions of Visual FoxPro make it possible for you to use forms as output-only elements in an Automation server application, the two run-time libraries in Visual FoxPro handle this situation differently for out-of-process and for in-process servers.

In-Process Servers
Apartment-model threading support requires that in-process .dll Automation servers not have user interfaces. In Visual FoxPro 5.0, it was possible (though not recommended) to create an in-process .dll Automation server that had a user interface such as a form. You could use the form only for display because the form events were not supported. Since Visual FoxPro 6, if you attempt to create a user interface in an in-process .dll, Automation generates an error. This is referred to as unattended mode.

Out-of-Process Servers
An out-of-process (.exe) Automation server can have a user interface. The Visual FoxPro function SYS(2335) enables you to disable UI and modal events for an out-of-process .exe Automation server so they can be handled remotely without user intervention. Modal events are created by user-defined modal forms, system dialogs, the MESSAGEBOX( ) function and the WAIT command, and so on and normally require user input.

Замечу также, что в .DLL фокс делает In-process Automation server и ничего другого.
...
Рейтинг: 0 / 0
создать dll фоксе и использовать в delphi
    #34685092
Декоратор
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Win32 DLL на VFP создать нельзя, только OLE Automation.
И такое
Код: plaintext
1.
DLLHandle := LoadLibrary(test.dll');
@Run := GetProcAddress(DLLHandle,'run');
Всегда нужно проверять на наличие ошибок.

Так соответвенно вызвать неполучится.
Только через:
Код: plaintext
1.
GetInterface(...)      - ранее связывание;
 CreateOleObject(...) - позднее связывание;
...
Рейтинг: 0 / 0
4 сообщений из 4, страница 1 из 1
Форумы / FoxPro, Visual FoxPro [игнор отключен] [закрыт для гостей] / создать dll фоксе и использовать в delphi
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]