Common Technical Questions and Answers to Delphi 3 and BDE/SQL Links 4.x - Active X/OLE/COM
Q: Automating Word 7: How do I automate Word 7?
A: You can get to any of the interfaces exposed by the word automation server. These can be found by loading MSWORD8.OLB into Delphi which will display the type library information. You can also use the Application's WordBasic property to get at the VB used in Word. The following sample demonstrates both avenues:
implementation uses ComObj; {$R *.DFM} var V: OleVariant; procedure TForm1.Button1Click(Sender: TObject); begin V := CreateOleObject('Word.Application'); V.ShowMe; V.WordBasic.FileNew; V.WordBasic.Insert('test'); V.Run('mymac'); V.WordBasic.FileSave; end; end.
Q: New methods not showing in code - insight window: I'm writing an in-process server and I'm adding some methods to it. However, they do not show up in the code-insight window, and my code doesn't compile. What is wrong?
A: You need to either reimport the type library into the client, or just use the type library wrapper (myserver_tlb.pas) that was created for you when you rebuilt the in-process server. If you imported the type library from the server and then modified the server, the wrapper for the server's type library will be out-dated.
Q: "EOleSys..operation unavailable" error using GetActiveOleObject: What is the cause and how do I resolve this error?
A: This occurs when using a Delphi automation server, or when the automation server (such as word.basic) is not running.
procedure TForm1.Button1Click(Sender: TObject); var V: OleVariant; begin V := GetActiveOleObject('Word.Basic'); V.FileNew; V.Insert('test'); end;GetActiveOleObject is defined in ComObj.pas. It converts the classname to a guid, and passes the guid to the Windows api call GetActiveObject.
function GetActiveOleObject(const ClassName: string): IDispatch; var ClassID: TCLSID; Unknown: IUnknown; begin ClassID := ProgIDToClassID(ClassName); OleCheck(GetActiveObject(ClassID, nil, Unknown)); OleCheck(Unknown.QueryInterface(IDispatch, Result)); end;The GetActiveOleObject uses an interface called IRunningObjectTable. We're not automatically registering to this table, so to have this functionality you must get this interface and use it's methods to register.
Q: Access violations with VC++ created OCX controls: AV's occur when using OCX created in VC++. The same OCX works OK in Visual Basic, but not in Delphi 3. What is wrong?
A: Versions of VC++ earlier than 4.2b have issues with event handling. There's a patch for VC++ on Microsoft's website.
Q: "Error saving I(Interface): The parameter is incorrect" error: I'm trying to build an automation server or ActiveForm/ActiveX and I'm trying to save the project and getting a "Error saving I(Interface): The parameter is incorrect". What is wrong?
A: The OLE DLLs on your machine are old. Install Internet Explorer off of the CD to upgrade those. Or take them from the RUNIMAGE directory on the Delphi 3.0 CD.
Q: "Error 0: RLINK32 error opening file (TypeLibrary).tlb" error: I'm trying to build an automation server or ActiveForm/ActiveX and I'm getting a "Error 0: RLINK32 error opening file my_type_library.tlb". What is wrong?
A: The OLE DLLs on your machine are old. Install Internet Explorer off of the CD to upgrade those. Or take them from the RUNIMAGE directory on the Delphi 3.0 CD.
Q: ActiveForms not displaying in Internet Explorer: Why do ActiveX or ActiveForms sometimes not display in Internet Explorer? All that shows up is the .htm page with a blank square with a little red X in it.
A: Its likely that you selected the licensing option when you created the ActiveForm and you are not deploying the .LIC file with your .OCX file.
Usually licensing is not used with ActiveForms/ActiveXs that are being used to enhance a web site because you are giving the control away for free.
To disable the design time licensing locate the initialization section in your ActiveForm's XXXImpl file and replace the second to last parameter of the TActiveXControlFactory.Create call to an empty string like so:
initialization TActiveXControlFactory.Create( ComServer, TAnimateX, TAnimate, Class_AnimateX, 1, '', 0); end.So, when should you use Design-Time Licensing?
Your control should use design-time only when you want to sell the ActiveX or ActiveForm to other developers who will then sell their finished applications to end-users. That is, the control works in a design-time environment (ie, Delphi, C++Builder, VB, etc.) when the LIC file is present, but it only works in a run-time environment (ie, the end-user application) when the .LIC file is not present.
If you're deploying your ActiveX over the web, then you are by definition deploying to end-users (as opposed to developers) and you should never require a design-time license.
Also, if the ActiveForm is unsigned, the Internet Explorer must have its "Active content security"
level set to medium. To do this, go to the control panel and select Internet. Go to the security
tab and then press the Safety Level button. Make sure the level it set to medium.
NOTE: This is only advised when designing your own controls. Potentially
rogue ActiveX controls could damage data on the machine!
Q: "TActiveFormX declaration missing or incorrect" Error: What does this error mean and how do I solve the problem?
A: This is usually caused by changing the name of an ActiveForm in the incorrect order (see README.TXT). If the name of the CoClass is changed first and then does a refresh, an AV will occur. Proceeding to use the Object Inspector to change the name of the form will cause "TActiveFormX declaration missing or incorrect". To fix this he will need to open the .DFM file and change the line:
object ActiveFormX: TActiveFormX to, object MyForm: TMyForm
If one of the above topics need to be elaborated on, or you do not see a simple question about Delphi 3 that is not answered above, send a short message to the BDE Administrator
US developer support questions should be handled through any of the Borland Assist options. Non-US developer support should be handled through an international Borland office in your area. The administrator of this page reserves the right to reply only to questions pertaining to the current page. All other types of inquiries will be ignored! Back To Top
Delphi Q and A Trademarks & Copyright © 1997 Borland International, Inc.