Solved

Access my own procedure

Posted on 2002-06-16
10
148 Views
Last Modified: 2010-04-04
In my component I have :

procedure TimerProc(uTimerID, uMessage: cardinal; dwUser, dw1, dw2: integer); stdcall;
begin
 CallMyProcedure;
end;

procedure TMyClass.CallMyProcedure;
begin
 DoSomething...
end;

How to do this call ?
I try with TMyClass(Self).CallMyProcedure but Self is unknown .
0
Comment
Question by:ginsonic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
10 Comments
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 7083002
Hello
 
  Is there an instance of your class?
var
  MyClass : TMyClass;
begin
  MyClass := TMyClass.Create;
  MyClass.CallMyProcedure;
  MyClass.Free;
end;

Best regards
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 7083030
or just do

  with TMyClass.Create do
    CallMyProcedure;
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 7083270
maybe you should transport your
object-pointer in the dwUser-flag
(if not needed for other things)

then it could show

procedure TimerProc(uTimerID, uMessage: cardinal; dwUser, dw1, dw2: integer); stdcall;
begin
TMyClass(Pointer(dwUser)).CallMyProcedure;
end;

meikl ;-)

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 9

Author Comment

by:ginsonic
ID: 7083481
That is it. Done now .
Thanks again,
Nick
0
 
LVL 9

Author Comment

by:ginsonic
ID: 7083551
Ups, problems :(
How I know the next code is ok so the problem is from call ????

I try to add an event in my procedure but get an ugly error message alike access violation at ...

FOnDone : TNotifyEvent;
............
protected
procedure NowDone(Value: TNotifyEvent);
............
property OnDone: TNotifyEvent read FOnDone write NowDone;
............

procedure TMyClass.CallMyProcedure;
begin
 if Assigned(FOnDone) then FOnDone(Self); /// here is the problem .

end;

procedure TMyClass.NowDone(Value: TNotifyEvent);
begin
 FOnDone:=Value;
end;
0
 
LVL 9

Author Comment

by:ginsonic
ID: 7083556
I try with
property OnDone: TNotifyEvent read FOnDone write FOnDone;
same problem.
0
 
LVL 9

Author Comment

by:ginsonic
ID: 7083575
procedure TimerProc(uTimerID, uMessage: cardinal; dwUser, dw1, dw2: integer); stdcall;
begin
   TMyClass(Pointer(dwUser)).Done;
end;

Think that here is the problem.

I test with

procedure TMyClass.Done;
begin
FD:=FDelay;
end;

Same problem.

For procedure TMyClass.Done;
begin
FD:=10;
end;

Is OK.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7083578
looks like ok,
closer look this evening
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7083583
?getting no notification from your last post
0
 
LVL 9

Author Comment

by:ginsonic
ID: 7083601
Is a server problem . No notifications for PAQ.
Hmm, what to do with my problem ?
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month4 days, 21 hours left to enroll

636 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