Solved

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

Posted on 1997-10-07
6
221 Views
Last Modified: 2010-04-04
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
Comment
Question by:angerer
6 Comments
 
LVL 1

Expert Comment

by:miv
ID: 1346923
Please elaborate on that...
What exactly are you doing from Delphi ?
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1346924
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
 
LVL 1

Author Comment

by:angerer
ID: 1346925
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 5

Expert Comment

by:JimBob091197
ID: 1346926
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
 
LVL 1

Accepted Solution

by:
lowlevel earned 300 total points
ID: 1346927
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
 
LVL 1

Author Comment

by:angerer
ID: 1346928
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
code issue 8 156
Convert a string into a TDateTime 5 64
Delphi: sending SMS on android platform 1 36
Firemonkey BASS_Init into a thread 17 31
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

829 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