import winim/[ utils
]
, winim/inc/[ windef
, winuser
]
, winimx
import the_types
proc get_accelerator_handle*(the_table: Win32_Accelerator_Table
): HACCEL =
# Used internally, generate the accelerator table on the fly.
# To avoid recursive module dependencies problem, move this from
# wAcceleratorTable.nim to here.
if the_table.was_modified:
if the_table.handle != 0:
winimx.DestroyAcceleratorTable the_table.handle
if the_table.accels.len != 0:
the_table.handle = CreateAcceleratorTable( addr the_table.accels[0]
, int32 the_table.accels.len
)
else:
the_table.handle = 0
the_table.was_modified = false
result = the_table.handle