BigNoob Posted February 24, 2018 Share Posted February 24, 2018 need to call the form from a dll and show it ;Delph 2010 ,Unit Form unit Form; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TMainForm = class(TForm) private { Private declarations } public { Public declarations } end; var MainForm: TMainForm; procedure ShowDllFormInPanel(Parent:THandle);stdcall procedure ShowDllForm;stdcall; implementation procedure ShowDllForm;stdcall; begin if MainForm = nil then MainForm:= TMainForm.Create(Application); MainForm.Show; end; procedure ShowDllFormInPanel(Parent:THandle);stdcall; begin Application.handle:=parent; if MainForm = nil then MainForm:= TMainForm.Create(Application); MainForm.ParentWindow:=Parent; MainForm.Show; end; {$R *.dfm} end. ; Delphi 2010, library UI; { 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 SysUtils, Classes, Form in 'Form.pas' {MainForm}; {$R *.res} exports ShowDllFormInPanel, ShowDllForm; begin end. ;autoit v 3.3.14.2 #Region ### START Koda GUI section ### Form= #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include<array.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 623, 449, 192, 114) $Tab1 = GUICtrlCreateTab(8, 0, 585, 441) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") GUICtrlCreateTabItem("") Local $hDLL = DllOpen("UI.DLL") Local $buffer $retVal=DllCall($hDLL,"None","ShowDllFormInPanel","hwnd",$TabSheet1) ; MsgBox(0, "DEBUG", "retVal[0]: " & $retVal[0] & ", retVal[4]: " & $retVal[4] & ", retVal[5]: " & $retVal[5] & ", buffer: " & $buffer) GUISetState(@SW_SHOW) DllClose($retVal) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Debug Source.zip Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now