Difference between revisions of "Arrays"
From Team Developer SqlWindows Wiki
(New page: This page covers arrays from any datatype tips & tricks. __TOC__ <br> <h2 style="margin:0;background-color:#ddcef2;font-size:120%;font-weight:bold;border:1px solid #afa3bf;text-align:lef...) |
DaveRabelink (Talk | contribs) |
||
Line 1: | Line 1: | ||
− | This page covers | + | '''This page covers Arrays from any datatype tips & tricks.''' |
__TOC__ | __TOC__ | ||
<br> | <br> | ||
− | < | + | <!------------------------------------------------------------------------------------------------------------------------------> |
+ | {{TipHeader|Passing arrays in messages (any datatypes)}} | ||
<sup>(From CenturaPro september 1999)</sup><br> | <sup>(From CenturaPro september 1999)</sup><br> | ||
To pass arrays using messages, use this nice trick to convert the address of any type of array<br> | To pass arrays using messages, use this nice trick to convert the address of any type of array<br> |
Revision as of 20:44, 24 September 2008
This page covers Arrays from any datatype tips & tricks.
Contents |
Passing arrays in messages (any datatypes) 
(From CenturaPro september 1999)
To pass arrays using messages, use this nice trick to convert the address of any type of array
to a number and send them along as wParam or lParam.
At the source (sending side) do this to pass arrays to a window
! Construct an array with weekdays Set saWeekDay[0] = "Monday" Set saWeekDay[1] = "Tuesday" Set saWeekDay[2] = "Wednesday" ! ! Construct an array with customer objects Set uaCustomer[0].sivCustomerName = "Brendan Perry" Set uaCustomer[0].nivCustomerID = 1 Set uaCustomer[1].sivCustomerName = "Lisa Gerrard" Set uaCustomer[1].nivCustomerID = 2 ! ! Get the address of the arrays as number Set nAddressStringArray = SalWindowHandleToNumber( saWeekDay ) Set nAddressUDVArray = SalWindowHandleToNumber( uaCustomer ) ! ! Send along the addresses as wParam and lParam Call SalPostMsg( frmMain, SAM_User, nAddressStringArray, nAddressUDVArray )
Now at the receiving side (frmMain), convert the array address back to an array variable
On SAM_User Call VisArrayCopy( SalNumberToWindowHandle( wParam ), saWeekDay, DT_String ) Call VisArrayCopy( SalNumberToWindowHandle( lParam ), uaCustomer, DT_Handle )