en:docs:win16:api:kernel:localflags

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:docs:win16:api:kernel:localflags [2023/05/01 10:44] – created prokusheven:docs:win16:api:kernel:localflags [2026/03/04 06:21] (current) prokushev
Line 1: Line 1:
 {{page>en:templates:win16api}} {{page>en:templates:win16api}}
  
-======  ======+====== LocalFlags ====== 
 +==== Brief ==== 
 +Returns information about a local memory object, including its lock count and discardable status.
  
-===== Brief =====+==== Syntax ==== 
 +<code c>UINT WINAPI LocalFlags( 
 +HLOCAL hMem 
 +);</code>
  
-===== Syntax =====+==== Parameters ====
  
-===== Parameters =====+hMem – Handle to the memory object.
  
-===== Return Code =====+==== Return Value ====
  
-===== Notes =====+The low‑order byte of the low‑order word contains the lock count. Use LMEM_LOCKCOUNT to mask this value.
  
-===== Example Code =====+The high‑order byte of the low‑order word indicates the allocation attributes (e.g., LMEM_DISCARDABLE, LMEM_DISCARDED).
  
-==== C Binding ====+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 ====
 +<code c>UINT flags = LocalFlags(hMem);
 +if (flags != LMEM_INVALID_HANDLE) {
 +WORD lockCount = flags & LMEM_LOCKCOUNT;
 +if (flags & 0x0F00) ... // discardable/discarded
 +}</code>
 ==== MASM Binding ==== ==== MASM Binding ====
 +<code asm>push hMem
 +call LocalFlags
 +and ax, LMEM_LOCKCOUNT ; extract lock count</code>
 +
 +==== See also ====
 +
 +  * [[LocalLock]]
 +  * [[LocalUnlock]]
  
-===== See also ===== 
  
 {{page>en:templates:win16}} {{page>en:templates:win16}}