[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Creating ActiveX objects on the fly

Posted on 1998-07-10
4
Medium Priority
?
188 Views
Last Modified: 2010-05-18
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 ?
0
Comment
Question by:rowem
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 2

Expert Comment

by:freter
ID: 1357661
Hi rowem! Try this:

procedure TForm1.Button1Click(Sender: TObject);
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.application', false);
    DoVerb(ovShow);
  end;
end;

This code creates OleContainers without any problems.
Cheers,
Freter
0
 
LVL 2

Expert Comment

by:freter
ID: 1357662
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
0
 

Author Comment

by:rowem
ID: 1357663
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
0
 
LVL 2

Accepted Solution

by:
freter earned 200 total points
ID: 1357664
Hi Michael!

To set the parent is always neccessary and to forget it is the most common mistake when creating objects on the fly ;-)

Nevertheless, glad I could help.

Freter
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question