I am developing the aa component in delphi 7 and delphi 2006 , the component uses a .pas file (not mine), for which the DLL must be present in the application directory.
Can I insert a DLL file into the component, so when the user places it on the form or creates it at run time, the DLL will be placed in the application directory?
currently
1) I suggest the user to place the DLL file in the application directory.
2) Add the DLL file to Resources, so that when I create it, can I leave the DLL in the application directory? from delphidabbler_embed_resource . I did it with
{Drop the Resource..!!!} procedure DropDllToApplicationDirectOry(applicationPath : string); var RS: TResourceStream; begin // Create resource stream RS := TResourceStream.CreateFromID(HInstance, 100, RT_RCDATA); try // applicationPath : example c:\MyTestProject Lee\ if DirectoryExists(applicationPath) then RS.SaveToFile(applicationPath+'myDllFileWhichIsNeeded.dll') finally // Free the stream RS.Free; end; end;
this DropDllToApplicationDirectOry take a resource from {$RmyDllFileWhichIsNeeded.dll.RES} and put it in the right place, but
How do I call DropDllToApplicationDirectOry this when I remove the component in the form?
I tried the initialization component, but the DLL is not copied, so I get an error 
RXControls For RXControls TRxClock , when we drop the clock in this form, the clock starts to run (show the current time) ... so I tried this
constructor Tmycomponeny.Create(AOwner: TComponent); begin inherited Create(AOwner); {add dll} DropDllToApplicationDirectOry(ExtractFilePath(Application.ExeName)); end;
But that does not work.
RXControls Code
constructor TRxClock.Create(AOwner: TComponent); begin inherited Create(AOwner); if not Registered then begin ClockInit; Registered := True; end; Caption := TimeToStr(Time); ControlStyle := ControlStyle - [csSetCaption] {$IFDEF WIN32} - [csReplicatable] {$ENDIF}; BevelInner := bvLowered; BevelOuter := bvRaised; FTimer := TRxTimer.Create(Self); FTimer.Interval := 450; { every second } FTimer.OnTimer := TimerExpired; FDotsColor := clTeal; FShowSeconds := True; FLeadingZero := True; GetTime(FDisplayTime); if FDisplayTime.Hour >= 12 then Dec(FDisplayTime.Hour, 12); FAlarmWait := True; FAlarm := EncodeTime(0, 0, 0, 0); end;
