|
Overview |
|
|
|
Group |
|
|
|
Quick Info
Windows NT
| Yes
| Win95
| Yes
| Win32s
| Yes
| Import Library
| kernel32.lib
| Header File
| winbase.h
| Unicode
| No
| Platform Notes
| None
|
|
|
GlobalLock
The
GlobalLock function locks a global memory object and returns a pointer to the first byte
of the object's memory block. The memory block associated with a locked memory
object cannot be moved or discarded. For memory objects allocated with the
GMEM_MOVEABLE flag, the function increments the lock count associated with the
memory object.
LPVOID GlobalLock(
HGLOBAL hMem
| // address of the global memory object
|
);
|
|
Parameters
hMem
Identifies the global memory object. This handle is returned by either the
GlobalAlloc or
GlobalReAlloc function.
Return Values
If the function succeeds, the return value is a pointer to the first byte of
the memory block.
If the function fails, the return value is NULL. To get extended error
information, call
GetLastError.
Remarks
The internal data structures for each memory object include a lock count that
is initially zero. For movable memory objects,
GlobalLock increments the count by one, and the
GlobalUnlock function decrements the count by one. For each call that a process makes to
GlobalLock for an object, it must eventually call
GlobalUnlock. Locked memory will not be moved or discarded, unless the memory object is
reallocated by using the
GlobalReAlloc function. The memory block of a locked memory object remains locked until its
lock count is decremented to zero, at which time it can be moved or discarded.
Memory objects allocated with the GMEM_FIXED flag always have a lock count of
zero. For these objects, the value of the returned pointer is equal to the
value of the specified handle.
If the specified memory block has been discarded or if the memory block has a
zero-byte size, this function returns NULL.
Discarded objects always have a lock count of zero.
See Also
GlobalAlloc,
GlobalFlags,
GlobalReAlloc,
GlobalUnlock
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database