winim/utils

This module contains utilities for happily coding in winim.

Procs

proc `&`[T](x: var T): ptr T {.inline.}
Use & like it in C/C++ to get address for anything.

Converters

converter winimConverterBooleanToBOOL(x: bool): BOOL {....raises: [], tags: [].}
Converter between Windows' BOOL/WINBOOL and Nim's boolean type
converter winimConverterBOOLToBoolean(x: BOOL): bool {....raises: [], tags: [].}
Converter between Windows' BOOL/WINBOOL and Nim's boolean type
converter winimConverterVarObjectToPtrObject[T: object](x: var T): ptr T
Pass an object by address if target is "ptr object". For example:
var msg: MSG
while GetMessage(msg, 0, 0, 0) != 0:
  TranslateMessage(msg)
  DispatchMessage(msg)

Templates

template `&`(x: object): ptr type(x)
Use & to gets pointer for const object. For example:
# pUk is "ptr IUnknown" for some object
var pDisp: ptr IDispatch
pUk.QueryInterface(&IID_IDispatch, &pDisp)