'===========================================================================
' Subject: POSITION DIALOG BOX                Date: 01-20-97 (15:11)       
'  Author: Carl Gundel                        Code: LB                     
'  Origin: carlg@world.std.com              Packet: LIBERTY.ABC
'===========================================================================

    'POSDIALG.BAS - Code snippet for Liberty BASIC v1.3 or better

    'This code snippet shows how to position a dialog
    'box when it is opened

    'define structures
    struct winRect, _
        orgX as uShort, _
        orgY as uShort, _
        extentX as uShort, _
        extentY as uShort

    struct point, _
        x as short, _
        y as short

    'open USER.DLL to make API calls
    open "user.dll" for dll as #user

    'get the current cursor position
    calldll #user, "GetCursorPos", _
        point as struct, _
        result as void
    x = point.x.struct
    y = point.y.struct

    'put the cursor where the origin of the window should be
    calldll #user, "SetCursorPos", _
        20 as ushort, _
        30 as ushort, _
        result as void

    'open the dialog box
    open "My Dialog Box" for dialog as #main

    'put the cursor back where it was
    calldll #user, "SetCursorPos", _
        x as ushort, _
        y as ushort, _
        result as void

    'close USER.DLL
    close #user

    'wait here
    input r$

    close #main

    end
