{{page>en:templates:win16api}} ====== LocalFlags ====== ==== Brief ==== Returns information about a local memory object, including its lock count and discardable status. ==== Syntax ==== UINT WINAPI LocalFlags( HLOCAL hMem ); ==== Parameters ==== hMem – Handle to the memory object. ==== Return Value ==== The low‑order byte of the low‑order word contains the lock count. Use LMEM_LOCKCOUNT to mask this value. The high‑order byte of the low‑order word indicates the allocation attributes (e.g., LMEM_DISCARDABLE, LMEM_DISCARDED). If the handle is invalid, the function returns LMEM_INVALID_HANDLE (0x7FFF). ==== Notes ==== For fixed objects, the lock count is always zero. Can be used to determine whether a block has been discarded (by checking for LMEM_DISCARDED in the high‑order byte). ==== Example Code ==== ==== C Binding ==== UINT flags = LocalFlags(hMem); if (flags != LMEM_INVALID_HANDLE) { WORD lockCount = flags & LMEM_LOCKCOUNT; if (flags & 0x0F00) ... // discardable/discarded } ==== MASM Binding ==== push hMem call LocalFlags and ax, LMEM_LOCKCOUNT ; extract lock count ==== See also ==== * [[LocalLock]] * [[LocalUnlock]] {{page>en:templates:win16}}