Skocz do zawartości

Problem z dll'em


staniki

Rekomendowane odpowiedzi

Chcę zrobić dll w Delphi do GMa, który będzie mi tworzył duży textbox (a mianowicie memo) i zapisywał tekst z tego memo do pliku. Zrobiłem coś takiego:

library memo;

{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }


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

var
handle: THandle;

procedure Init(h:double); cdecl;
begin
handle:=round(h);
end;
function CreateMemo(x,y,w,h:double):double; cdecl;
var
TempMemo: TMemo;
begin
TempMemo:=TMemo.Create(nil);
TempMemo.Left:=round(x);
TempMemo.Top:=round(y);
TempMemo.Width:=round(w);
TempMemo.Height:=round(h);
TempMemo.ScrollBars:=ssBoth;
TempMemo.ParentWindow := handle;
result:=TempMemo.Handle;
end;

procedure SaveMemoText(h: double; path: string); cdecl;
var
hand: THandle;
TempMemo: TMemo;
begin
hand:=round(h);
TempMemo:=TMemo.Create
TempMemo.Lines.SaveToFile(path);
end;

exports Init, CreateMemo, SaveMemoText;

{$R *.res}

begin
end.

 

i przy wykonywaniu pierwszej funkcji, gra się sypie. Nie umiem dobrze delphi, jestem bardzo począdkujący i prosiłbym was o pomoc. W GMie jest wszystko OK.

Odnośnik do komentarza
Udostępnij na innych stronach

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...