[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 227
  • Last Modified:

ActiveX: How to implement an intern method in an ActiveX control.

I am writing ActiveX controls with Delphi3. I have no problems to use them in VB5 and to access their properties and events.

But when i call an intern method of an ActiveX - nothing happens.
VB5 shows me the name of the method (it is in the published section) - i only have to select it in the listbox, but when i run the program the code of the intern method is not executed.

Thank you very much for help.

DI Bernhard Angerer
Vienna University of Technology
0
angerer
Asked:
angerer
1 Solution
 
mivCommented:
Please elaborate on that...
What exactly are you doing from Delphi ?
0
 
JimBob091197Commented:
Is it a standard method that Delphi put there, or is it one of your own methods?  If it is one of your own methods, did you add it using Delphi's Type Library Editor?
0
 
angererAuthor Commented:
ok ...

My Testcontrols looks like that:

----------------------
unit TestEdit;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TTestEdit = class(TEdit)
  private
  protected
  public
  published
    procedure InternMethod;
  end;

procedure Register;
implementation


procedure TTestEdit3.InternMethod;
begin
  Text := 'xxx';
end;


procedure Register;
begin
  RegisterComponents('TEST', [TTestEdit]);
end;

end.
----------------------

1.
I open a new ActiveX project. The code for the ActiveX and
a Type Libary is automatically created.

2.
In the Type Libary Editor i can see my procedure "InternMethod".
I press the button "Register"

3.
In VB5 i select the OCX via Project/Components

4.
I drop the control in an empty form. The name of the control
is "TestEditX1". That still works.

5.
In the code editor of vb i write

TestEditX1.

than the listbox with all the properties and methods appears.
I select "InternMethod". Than the hole line is

TestEditX1.InternMethod

6.
When i execute this line i get the message:

Run-time-error "438"
Object does not support this property method


I do not know what to do ?

Thanks for help !!!
0
Independent Software Vendors: 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!

 
JimBob091197Commented:
This is very strange.  
It sounds to me like your OCX file and TLB file are out of synch.  Does your ActiveX Control unit (i.e. the one with "TTestEditX = class(TActiveXControl, ITestEditX)" at the top, not the TLB unit) have a method "procedure InternMethod; safecall;" in its protected section?

I have noticed that with ActiveX controls it is possible to get the ActiveX control unit out of synch with the TLP file by manually editing the ActiveX unit.  Have you checked that these 2 units have exactly the same methods?

JB
0
 
lowlevelCommented:
This might be an answer:

Delphi creates an activeX project that gets registred. The activeX project has a function called internMethod, just like your tTestEdit. Are you sure that the activeX wrapper component refers the call to the tTestEdit comp?

It should look something like this, and I think this should be in your activeX implementation unit.

procedure txTestEdit.internMethod;
begin
  fDelphiControl.internMethod;
end;
0
 
angererAuthor Commented:
now it works - i am not sure why
in some cases i think (i am embarrassed) it was the case that the warapper forget the link to the method in my control

anyway
thanks very much
bernhard
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now