

Kod: Tümünü seç
library DLLFormDLL;
uses
Forms,
SysUtils,
Classes,
DLLFormUnit in 'DLLFormUnit.pas' {Form1};
{$R *.res}
Procedure KayitFormu;
begin
Application.CreateForm(TForm1, Form1);
Form1.ShowModal;
end;
Exports
KayitFormu;
begin
end.
Kod: Tümünü seç
Procedure KayitFormu; StdCall; External 'D:\Programcilik\Delphi\Guncel\DLL Form ornegi\DLLFormDLL.dll';
procedure TForm1.Button1Click(Sender: TObject);
begin
KayitFormu;
end;
Kod: Tümünü seç
procedure Mdichildgoster(MainApp: TApplication; Formname: string; kullanici:
string; ADMINMI: string); export;
begin
if not Assigned(DllApp) then
begin
DllApp := Application;
Application := MainApp;
end;
//////////////////////////////////////////////////////////////////////
if Formname='Frm_stokizleme' then
begin
if not assigned(Frm_stokizleme) then
begin
Frm_stokizleme := TFrm_stokizleme.Create(Application.MainForm);
Frm_stokizleme.FormStyle := fsmdichild;
Frm_stokizleme.Show;
end;
end;
////////////////////////////////////////////////////////////////////////
end;
procedure MyDLLProc(Reason: Integer);
begin
if Reason = DLL_PROCESS_DETACH then
{ DLL is unloading. Restore the Application pointer. }
if Assigned(DllApp) then
Application := DllApp;
end;
begin
DLLProc := @MyDLLProc;
end.
Exedende dinamik çağırıyorum aşağıdaki gibi
var
Handle: integer;
Mdichildgoster: procedure(Application: Tapplication; Formname: string;
kullanici: string; ADMIN: string);
begin
try
Screen.Cursor := crSQLWait;
handle := LoadLibrary('../moduller/stok/stokmdl.dll');
if Handle <> 0 then
begin
@Mdichildgoster := GetProcAddress(handle, 'Mdichildgoster');
if @Mdichildgoster <> nil then
Mdichildgoster (Application, 'Frm_stokizleme', username, ADMINUSER)
else
begin
ShowMessage('HATA : 00001, Çağrılan Procedure Bulunamadı [Stok Modülü]');
end;
end
else
begin
ShowMessage('HATA : 00002, Stokmdl Dll Kütüphanesi Bulunamadı [Stok Modülü]');
FreeLibrary(Handle);
end;
finally
Screen.Cursor := crDefault;
end;
end;
Kod: Tümünü seç
procedure TForm1.Button2Click(Sender: TObject);
var
Handle: integer;
KayitFormu: Procedure;
begin
try
Screen.Cursor := crSQLWait;
handle := LoadLibrary('D:\Programcilik\Delphi\Guncel\DLL Form ornegi\DLLFormDLL.dll');
if Handle <> 0 then
begin
@KayitFormu := GetProcAddress(handle, 'KayitFormu');
if @KayitFormu <> nil then
KayitFormu
else
begin
ShowMessage('HATA : 00001, Çağrılan Procedure Bulunamadı [Stok Modülü]');
end;
end
else
begin
ShowMessage('HATA : 00002, Stokmdl Dll Kütüphanesi Bulunamadı [Stok Modülü]');
FreeLibrary(Handle);
end;
finally
Screen.Cursor := crDefault;
end;
end;
Kod: Tümünü seç
type
TForm1 = class(TForm)
...
private
...
procedure ApplicationMessage(var Msg: TMsg; var Handled: Boolean);
...
end;
<--------------->
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage := ApplicationMessage;
end;
procedure TForm1.ApplicationMessage(var Msg: TMsg; var Handled: Boolean);
begin
if (Msg.Message = WM_KEYDOWN) and (Msg.wParam = VK_TAB) then
begin
self.Perform(Wm_NextDlgCtl, 0, 0);
end;
end;