<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <title>
      myOffice Email Message
    </title>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
    <meta name="date" content="2002-11-01">
  <style type="text/css">
  </style>
  </head>
  <body>
    <span style=
      "color:#FF0000 "><b><span style=
      "font-family:MS Sans Serif ">[Reply]</span></b></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#000000 ">Hi all,</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#000000 ">To "send a string" using windows messaging, use Global Atoms, and send the reference to the Atom in the Windows Message.</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#000000 ">Look at:</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#000000 ">http://www.delphipages.com/threads/thread.cfm?ID=24029&amp;G=24027</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#000000 ">cheers</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#000000 ">Gary</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#000000 ">A</span><span style=
      "color:#FF0000 "><b>t 19:43 on 24/11/2005 you wrote </b></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;To  : rohit@cfl.co.nz,delphi@ns3.123.co.nz</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;CC  : </span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;From: Kyley Harris, kyleyharris@gmail.com</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;Content Type: text/plain</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;Attached: </span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;There are two basic ways to send a string, seeing as we are talking  </span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;postmessage,</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;here is the fugly one.</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;p:phar;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;GetMem(p,length(data));</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;move(data[1],p^,length(data));</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;postmessage(bla bla , integer(p));</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;remember to free mem on the other side.</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;Better and nicer way</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;TString = class(TObject)</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;   property data:string;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;end;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;Create and send a reference to this, and free it when you are finished.</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;remember none of these options is safe outside of your own application.</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;On Thu, 24 Nov 2005 17:43:51 +1300, Rohit Gupta &lt;rohit@cfl.co.nz&gt; wrote:</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; I cant see how it can be safe.  I was stumped as well when I wanted</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; to send a string in a message.  I had to abandon my ideas....  :-( Let</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; me know if you have any joy.</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; From:           &nbsp;&nbsp;&nbsp;&nbsp;"Paul Lowman" &lt;paul_lowman@xtra.co.nz&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; To:             &nbsp;&nbsp;&nbsp;&nbsp;"Delphi List" &lt;delphi@delphi.org.nz&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; Date sent:      &nbsp;&nbsp;&nbsp;&nbsp;Thu, 24 Nov 2005 16:22:04 +1300</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; Copies to:      &nbsp;&nbsp;&nbsp;&nbsp;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; Subject:        &nbsp;&nbsp;&nbsp;&nbsp;[DUG] Reference counting</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; Send reply to:  &nbsp;&nbsp;&nbsp;&nbsp;NZ Borland Developers Group - Delphi List  </span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; &lt;delphi@ns3.123.co.nz&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; &nbsp;&nbsp;&nbsp;&nbsp;&lt;mailto:delphi-request@ns3.123.co.nz?subject=unsubscribe&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; &nbsp;&nbsp;&nbsp;&nbsp;&lt;mailto:delphi-request@ns3.123.co.nz?subject=subscribe&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; [ Double-click this line for list subscription options ]</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; Heres one for the gurus -</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; Assume  a long string variable is declared locally to a method and is</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; assigned a string and the string variable is then typecast as an integer  </span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; and</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; used in - say - a windows message by assigning it to the message lparam.</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; The question is when the message is received by another form / thread is  </span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; it</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; valid to then typecast the lparam back to a string and use it ?</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; I have tried many variations of this scenario and it seems to work OK  </span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; but am</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; uneasy about whether or not this is safe. I assume it isn't as the local</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; string variable (which points to the actual string) is on the stack and  </span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; is</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; not maintained after the method is exited but what I really am concerned</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; about is the reference count for the string - has it been increased by</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; typecasting it to an integer / pointer whatever ...</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; I have used some of Marco Cantu's code to try and examine the strings</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; reference count and it always appears to be -1 if the string is a local</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; variable although it works correctly for field or global.</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; All very confusing :-)</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; I would like to know how the code knows when to inc / dec / dispose the</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; stirng / array reference count.</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; Cheers</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; Paul Lowman</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; _______________________________________________</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; Delphi mailing list</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; Delphi@ns3.123.co.nz</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; http://ns3.123.co.nz/mailman/listinfo/delphi</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; Regards</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; Rohit</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; ======================================================================</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; CFL - Computer Fanatics Ltd.  21 Barry's Point Road, AKL, New Zealand</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; PH    (649) 489-2280</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; FX    (649) 489-2290</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; email rohit@cfl.co.nz  or  r.gupta@xtra.co.nz</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; ======================================================================</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; _______________________________________________</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; Delphi mailing list</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; Delphi@ns3.123.co.nz</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;&gt; http://ns3.123.co.nz/mailman/listinfo/delphi</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;-- </span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;Kyley Harris</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;+64-21-671821</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;_______________________________________________</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;Delphi mailing list</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;Delphi@ns3.123.co.nz</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;http://ns3.123.co.nz/mailman/listinfo/delphi</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#008000 ">&gt;</span></span><p>
  <font face=arial size = 1 color = Navy><DIV style="WIDTH: 260px; HEIGHT: 50px"><MARQUEE id=marquee1 style="WIDTH: 260px; HEIGHT: 200px" trueSpeed scrollAmount=5 scrollDelay=20 direction=right behavior=slide loop=1 border="2"><hr><table><tr><td><FONT color=black size=4 face = "helvetica,verdana,arial">Gary Benner </FONT></td></tr><tr><td><FONT face="arial, arial, helvetica, sans-serif" color=black size=2>e-Engineer, Lecturer, and Software Developer</FONT></td></tr><br>
<tr><td bgcolor=><FONT face="arial, arial, helvetica, sans-serif" color=#000099 size=2><B><A HREF="http://www.123.co.nz" style="text-decoration:none; color:blue">123 Internet Limited</A></B></FONT></td></tr><tr><td bgcolor=><FONT face="arial, arial, helvetica, sans-serif" color=#000099 size=2><B><A HREF="http://www.waiariki.ac.nz" style="text-decoration:none; color:#993333">Waiariki Institute of Technology</A></B></FONT></td></tr><tr><td bgcolor=><FONT face="arial, arial, helvetica, sans-serif" color=#CECE00 size=2><B><A HREF="http://www.sunshinebags.co.nz" style="text-decoration:none; color:#CECE00">Sunshine Garden Bag Co.</A></B></FONT></td></tr><tr><td bgcolor=><FONT face="arial, arial, helvetica, sans-serif" color=red size=2><B><A HREF="http://www.sommnet.com" style="text-decoration:none; color:red" >Sommnet.com Limited</A></B></FONT></td></tr><tr><td><font face =  22helvetica,verdana,arial" size = 1>Mob: 021 966 992</font></td></tr><tr><td><font face = "helvetica,verdana,arial" size = 1>Email: <A href="mailto:gary@123.co.nz" >gary@123.co.nz</A> </font></td></tr></table></MARQUEE></DIV><br>
<br>
Ref#: 41006<br>
<br>
</body>
</html>