Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > API de Windows
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 20-04-2005
Juan Carlos Juan Carlos is offline
Miembro
 
Registrado: may 2004
Posts: 24
Poder: 0
Juan Carlos Va por buen camino
Obtener DirecciÓn De Memoria

Saludos A Todos:

Por Favor Necesito Saber Como Obtener La DirecciÓn De Memoria Donde Esta Cargada Una FunciÓn O Procedimiento Y Como Mandalra A Llamar A Traves De Un Apuntador.

Si Existe Alguna FunciÓn, Me PodrÍan Explicar Con CÓdigo, O CÓmo Se PodrÍa Implementar...

Gracias......
Responder Con Cita
  #2  
Antiguo 20-04-2005
Avatar de Lepe
[Lepe] Lepe is offline
Miembro Premium
 
Registrado: may 2003
Posts: 7.424
Poder: 28
Lepe Va por buen camino
Código Delphi [-]
procedure TForm1.FormCreate(Sender: TObject);
begin
  Button1.Onclick := MibotonClick;
end;

procedure TForm1.MibotonClick(Sender: TObject);
begin
 ....
end;

Simplemente es lo que hace delphi con cualquier evento, en realidad son apuntadores a la dirección de memoria donde está el procedimiento MibotonClick.

Di exactamente que quieres hacer para tener una respuesta más precisa. TnotifyEvent puede ser tu solución.

Un saludo
__________________
Si usted entendió mi comentario, contácteme y gustosamente,
se lo volveré a explicar hasta que no lo entienda, Gracias.
Responder Con Cita
  #3  
Antiguo 20-04-2005
Juan Carlos Juan Carlos is offline
Miembro
 
Registrado: may 2004
Posts: 24
Poder: 0
Juan Carlos Va por buen camino
direccion de memoria

Es que necesito saber si se puede obtener la direccion de memoria, donde se almacena una funcion o procedimiento.
por ejemplo: la funcion agregar, tiene una direcccion 12345, dada esa direccion, poder ejecutar dicha funcion o procedimiento. espero qe me haya explicado.
Responder Con Cita
  #4  
Antiguo 20-04-2005
Avatar de Lepe
[Lepe] Lepe is offline
Miembro Premium
 
Registrado: may 2003
Posts: 7.424
Poder: 28
Lepe Va por buen camino
¿esto?
Cita:
Empezado por Procedural types in statements and expressions
When a procedural variable is on the left side of an assignment statement, the compiler expects a procedural value on the right. The assignment makes the variable on the left a pointer to the function or procedure indicated on the right. In other contexts, however, using a procedural variable results in a call to the referenced procedure or function. You can even use a procedural variable to pass parameters:
Código Delphi [-]
var

  F: function(X: Integer): Integer;
  I: Integer;
function SomeFunction(X: Integer): Integer;
 ...
F := SomeFunction;  // assign SomeFunction to F
I := F(4);          // call function; assign result to I
In assignment statements, the type of the variable on the left determines the interpretation of procedure or method pointers on the right. For example,
Código Delphi [-]
var

  F, G: function: Integer;
  I: Integer;
function SomeFunction: Integer;
 ...
F := SomeFunction;  // assign SomeFunction to F
G := F;             // copy F to G
I := G;             // call function; assign result to I
The first statement assigns a procedural value to F. The second statement copies that value to another variable. The third statement makes a call to the referenced function and assigns the result to I. Because I is an integer variable, not a procedural one, the last assignment actually calls the function (which returns an integer).
In some situations it is less clear how a procedural variable should be interpreted. Consider the statement

if F = MyFunction then ...;

In this case, the occurrence of F results in a function call; the compiler calls the function pointed to by F, then calls the function MyFunction, then compares the results. The rule is that whenever a procedural variable occurs within an expression, it represents a call to the referenced procedure or function. In a case where F references a procedure (which doesn’t return a value), or where F references a function that requires parameters, the statement above causes a compilation error. To compare the procedural value of F with MyFunction, use

if @F = @MyFunction then ...;
@F converts F into an untyped pointer variable that contains an address, and @MyFunction returns the address of MyFunction.
To get the memory address of a procedural variable (rather than the address stored in it), use @@. For example, @@F returns the address of F.
The @ operator can also be used to assign an untyped pointer value to a procedural variable. For example,

var StrComp: function(Str1, Str2: PChar): Integer;

...
@StrComp := GetProcAddress(KernelHandle, 'lstrcmpi');

calls the GetProcAddress function and points StrComp to the result.
Any procedural variable can hold the value nil, which means that it points to nothing. But attempting to call a nil-valued procedural variable is an error. To test whether a procedural variable is assigned, use the standard function Assigned:

if Assigned(OnClick) then OnClick(X);
Saludos
__________________
Si usted entendió mi comentario, contácteme y gustosamente,
se lo volveré a explicar hasta que no lo entienda, Gracias.

Última edición por Lepe fecha: 20-04-2005 a las 14:42:38.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 23:38:55.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi