Thanks to Maze Solver example I've also improved calling of API functions.
In your script I saw the following code:
function Draw_Grid() as long
dim col_count as dword
dim row_count as dword
dim x1,x2,y1,y2 as dword
dim pt as POINT_TYPE
SelectObject(hdc, GetStockObject(%BLACK_PEN) )
'x2 = gridRight
for row_count = 0 to astar_RowCount
x1 = gridLeft
y1 = gridTop + (row_count * cellHeight)
MoveToEx(hdc,x1,y1,pt)
y2 = y1
LineTo(hdc,gridRight,y2)
next
'y2 = gridBottom
for col_count = 0 to astar_ColumnCount
x1 = gridLeft + (col_count * cellWidth)
y1 = gridTop
MoveToEx(hdc,x1,y1,pt)
x2 = x1
LineTo(hdc,x2,gridBottom)
next
end function
Now, you defined "DIM pt as POINT_TYPE" only because "MoveToEx" need a POINT_TYPE structure. In other languages you can pass both a structure BYREF or a value representing the memory address where the structure is located. From next preview version this will be possible also in thinBasic, that is if parser will find a structure, its memory address will be passed otherwise if parser will find a numeric expression, the result of the numeric expression will be passed. In this way script can be
[code=thinbasic]
MoveToEx(hdc,x1,y1,%NULL) '---Here %NULL means no UDT is passed
[/code]
or
[code=thinbasic]
MoveToEx(hdc,x1,y1,0) '---Here 0 means no UDT is passed
[/code]
without the need to declare a structure.
Feature will be present in next thinBasic preview 1.4.0.1 release
Regards
Eros
Bookmarks