Solved

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

Posted on 1997-10-07
6
220 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

831 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