Upgrade Note

[Top]  [Chapter]  [Previous]  [Next]

The new programming interface had to change the types of parameters which represent a pointer.

(This change does not affect the OCX version - the OCX is only available as 32bit module)

 

They have been changed from "int" type to "IntPtr" which is, depending on the CPU 32 or 64 bit.

 

In the previous version this values can be handled as an int, now an IntPtr is required to be able to provide 64bit support.

 

Please note that it is not possible compare an IntPtr with null or 0. Instead compare it with IntPtr.Zero:

 

instead

 if(i) ....

or

 if(i != 0) ....

now write

if( i != IntPtr.Zero ) ...

 

Example:

 

Old code:

 

// This event handler implements a text object which shows information about its own parent paragraph

     

 

   private void wpdllInt1_OnTextObjectGetText(object Sender, int Editor, int PageNr, IWPTextObj TextObj)

       {

          if (TextObj.Name == "COUNTCHAR")

           {

              IWPMemo Memo = wpdllInt1.Memo;

              int i = Memo.CurrPar.GetPtr();

              int p = Memo.TextCursor.CPPosInPar;

               Memo.CurrPar.SetPtr(TextObj.GetParentParPtr());

 

               TextObj.Params = "Chars:" + Memo.CurrPar.CharCount.ToString();

 

               Memo.CurrPar.SetPtr(i);

               Memo.TextCursor.CPPosInPar = p;

           }

       }

 

 

New code:

 

 

      private void wpdllInt1_OnTextObjectGetText(object Sender, int Editor, int PageNr, IWPTextObj TextObj)

       {

          if (TextObj.Name == "COUNTCHAR")

           {

              IWPMemo Memo = wpdllInt1.Memo;

              IntPtr i = Memo.CurrPar.GetPtr();

              int p = Memo.TextCursor.CPPosInPar;

               Memo.CurrPar.SetPtr(TextObj.GetParentParPtr());

 

               TextObj.Params = "Chars:" + Memo.CurrPar.CharCount.ToString();

 

               Memo.CurrPar.SetPtr(i);

               Memo.TextCursor.CPPosInPar = p;

 

           }

       }


[upgrade_notes.htm]    Copyright © 2007 by WPCubed GmbH