Board index » delphi » show a pointer, not what the pointer points to

show a pointer, not what the pointer points to

Try casting it as a Longint:

        n := Longint(p);

I expect that Delphi will permit this typecast.  Notice the omission of
a "^" in the above statement.

Quote
>Ron TJ HUANG wrote:

> Can someone tell me how I can showmessage the what is inside a Pointer
> variable, (show the address as string), but not show what a pointer points
> to?

------------------------------------------------------------------
Sundial Services :: Scottsdale, AZ (USA) :: (480) 946-8259
mailto:i...@sundialservices.com  (PGP public key available.)
Quote
> Fast(!), automatic table-repair with two clicks of the mouse!
> ChimneySweep(R):  "Click click, it's fixed!" {tm}
> http://www.sundialservices.com/products/chimneysweep

 

Re:show a pointer, not what the pointer points to


Can someone tell me how I can showmessage the what is inside a Pointer
variable, (show the address as string), but not show what a pointer points
to?

tks.

Ron.

Re:show a pointer, not what the pointer points to


Quote
Ron TJ HUANG wrote:
> Can someone tell me how I can showmessage the what is inside a Pointer
> variable, (show the address as string), but not show what a pointer
points
> to?

{uses SysUtils }
ShowMessage(Format('%0.8x', [INTEGER(YourPointer)]));
or
ShowMessage(IntToHex(INTEGER(YourPointer),8));

-ThomasN

Re:show a pointer, not what the pointer points to


On 23 Oct 2000 01:48:11 GMT, "Ron TJ HUANG" <ron_hu...@psitech.com.tw>
wrote:

Quote
>Can someone tell me how I can showmessage the what is inside a Pointer
>variable, (show the address as string), but not show what a pointer points
>to?

Sure, typecast it as an integer:

  ShowMessage(IntToStr(Integer(MyPointer)));

Alternatively the Format() routine has the "%p" parameter that formats
a pointer as a string.  

Stephen Posey
slpo...@concentric.net

Re:show a pointer, not what the pointer points to


Many thanks to all of u.  It works.

Regards,
Ron.

Ron TJ HUANG <ron_hu...@psitech.com.tw> wrote in message
news:8t05cr$473$1@news.seed.net.tw...

Quote
> Can someone tell me how I can showmessage the what is inside a Pointer
> variable, (show the address as string), but not show what a pointer points
> to?

> tks.

> Ron.

Re:show a pointer, not what the pointer points to


Format('%p', [pointer]);  // = 8 character address
Quote
Ron TJ HUANG wrote:

> Can someone tell me how I can showmessage the what is inside a Pointer
> variable, (show the address as string), but not show what a pointer points
> to?

> tks.

> Ron.

Other Threads