rowem
asked on
Creating ActiveX objects on the fly
I wish to create ActiveX objects on the fly using Delphi 3 using only their GUID. If I create a form containing a TOleContainer object I can use this to host an ActiveX object. However I don't know the number of ActiveX objects I wish to host at design time and creating TOleContainer objects on the fly using TOleContainer.Create seems to fail. How can I solve this problem ?
Ah, BTW: The DoVerb(ovShow) doesn't work with Word.Application... Sorry!
Check it out with any ActiveForm that you have created using Delphi. It works out alright, I have tried it myself.
Regards, Freter
Check it out with any ActiveForm that you have created using Delphi. It works out alright, I have tried it myself.
Regards, Freter
ASKER
Freter,
If you would like the points please feel free to submit this as the answer. The Parent:=Self is what I hadn't done. I would have thought that the parent should be set in the Create constructor though, since we pass it through as a parameter....
Regards, Michael
If you would like the points please feel free to submit this as the answer. The Parent:=Self is what I hadn't done. I would have thought that the parent should be set in the Create constructor though, since we pass it through as a parameter....
Regards, Michael
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
procedure TForm1.Button1Click(Sender
var Cont: TOleContainer;
begin
Cont := TOleContainer.Create(self)
with cont do begin
parent := self;
left := 50;
top := 50;
width := 200;
height := 300;
visible := true;
CreateObject('word.applica
DoVerb(ovShow);
end;
end;
This code creates OleContainers without any problems.
Cheers,
Freter