[DLL] Constructeur à l'objet suffisant pour autres langages ?

Bacterius Messages postés 3792 Date d'inscription samedi 22 décembre 2007 Statut Membre Dernière intervention 3 juin 2016 - 21 janv. 2009 à 19:07
Bacterius Messages postés 3792 Date d'inscription samedi 22 décembre 2007 Statut Membre Dernière intervention 3 juin 2016 - 21 janv. 2009 à 20:36
Bonjour, alors voici mon problème - j'essaye d'introduire mon unité AlphaUtils dans une DLL. Tout roule pour l'instant, mais je voudrais juste savoir si un simple constructeur d'objet exporté suffit à un autre langage pour utiliser l'objet. Voyez plutôt (je ne vous montre pas l'unité AlphaUtilsUnit, elle est sur le site) :


<hr />

library AlphaUtils;uses
  Windows,
  Types,
  SysUtils,
  Classes,
  AlphaUtilsUnit in 'AlphaUtilsUnit.pas';

{$R *.res}

function CreateTList: TList; stdcall; // Ici !
begin
 Result := TList.Create;
end;

function CreateTLayeredWindow(Wnd: HWND; BackToOldStyle, DoNotTouchLayeredSettingsParam: Boolean; ForceLayering: Boolean): TLayeredWindow; stdcall; // Ici !
begin
 Result : = TLayeredWindow.Create(Wnd, BackToOldStyle, DoNotTouchLayeredSettingsParam, ForceLayering);
end;

function GetTrayHWnd: HWND; stdcall;
begin
 Result := AlphaUtilsUnit.GetTrayHWnd;
end;

function SearchHWnds(var HwndList: TList): Longword; stdcall;
begin
 Result := AlphaUtilsUnit.SearchHWnds(HwndList);
end;

function GetHWndByWindowName(WindowName: String): HWND; stdcall;
begin
 Result := AlphaUtilsUnit.GetHWndByWindowName(WindowName);
end;

function GetHWndByWindowClassName(WindowClassName: String): HWND; stdcall;
begin
 Result := AlphaUtilsUnit.GetHWndByWindowClassName(WindowClassName);
end;

function PrepareLayering(Wnd: HWND): Boolean; stdcall;
begin
 Result := AlphaUtilsUnit.PrepareLayering(Wnd);
end;

function ReleaseLayering(Wnd: HWND): Boolean; stdcall;
begin
 Result := AlphaUtilsUnit.ReleaseLayering(Wnd);
end;

function SupportsLayering(Wnd: HWND): Boolean; stdcall;
begin
 Result := AlphaUtilsUnit.SupportsLayering(Wnd);
end;

function GetWindowAlpha(Wnd: HWND; var Value: Byte): Boolean;
begin
 Result := AlphaUtilsUnit.GetWindowAlpha(Wnd, Value);
end;

function SetWindowAlpha(Wnd: HWND; var Value: Byte): Boolean;
begin
 Result := AlphaUtilsUnit.SetWindowAlpha(Wnd, Value);
end;

function GetLayeredWindowAttributes(hWnd: HWND; var crKey: COLORREF; var bAlpha: BYTE; var dwFlags: DWORD): BOOL; stdcall;
begin
 Result := AlphaUtilsUnit.GetLayeredWindowAttributes(hWnd, crKey, bAlpha, dwFlags);
end;

function SetLayeredWindowAttributes(hWnd: HWND; crKey: COLORREF; bAlpha: BYTE; dwFlags: DWORD): BOOL; stdcall;
begin
 Result := AlphaUtilsUnit.SetLayeredWindowAttributes(hWnd, crKey, bAlpha, dwFlags);
end;

function IsHungAppWindow(hWnd: HWND): Bool; stdcall;
begin
 Result := AlphaUtilsUnit.IsHungAppWindow(hWnd);
end;

exports
 CreateTList, // Ce constructeur ...
 CreateTLayeredWindow, // ... et celui-là suffisent-t-ils pour un autre langage ?
 GetTrayHWnd,
 SearchHWnds,
 GetHWndByWindowName,
 GetHWndByWindowClassName,
 PrepareLayering,
 ReleaseLayering,
 SupportsLayering,
 GetWindowAlpha,
 SetWindowAlpha,
 GetLayeredWindowAttributes,
 SetLayeredWindowAttributes,
 IsHungAppWindow;

begin
end.

<hr />

Je veux dire par là, faut-il que j'introduise dans la DLL toutes les méthodes de l'objet TList et TLayeredWindow pour le rendre utilisable en C ou en VB, par exemple ? Ou est-ce-que une simple référence à l'objet suffit (je précise qu'une documentation sera fournie, et que les autres langages pourront écrire la structure de l'objet TLayeredWindow dans leur code ...).

Merci de votre réponse :)

Cordialement, Bacterius !

2 réponses

Cirec Messages postés 3833 Date d'inscription vendredi 23 juillet 2004 Statut Modérateur Dernière intervention 18 septembre 2022 50
21 janv. 2009 à 20:33
Salut,

regarde ceci : http://delphi.ftp-developpez.com/cours/dll/Moreno_DLLObjet.pdf
je pense que ça va t'éclairer sur le principe

 
@+
Cirec

<hr siz="" />
0
Bacterius Messages postés 3792 Date d'inscription samedi 22 décembre 2007 Statut Membre Dernière intervention 3 juin 2016 10
21 janv. 2009 à 20:36
Merci Cirec, je vais regarder.
Au fait, j'avais oublié de transtyper en PChar dans le code de la DLL.

Cordialement, Bacterius !
0
Rejoignez-nous