Solved

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

Posted on 1997-10-07
6
218 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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 this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now