EN
此内容没有您的语言版本,但有英语版本。

GetHGlobalFromILockBytes function

The GetHGlobalFromILockBytes function retrieves a global memory handle to a byte array object created using the CreateILockBytesOnHGlobal function.

Syntax


WINOLEAPI GetHGlobalFromILockBytes(
  _In_   ILockBytes *pLkbyt,
  _Out_  HGLOBAL *phglobal
);

Parameters

pLkbyt [in]

Pointer to the ILockBytes interface on the byte-array object previously created by a call to the CreateILockBytesOnHGlobal function.

phglobal [out]

Pointer to the current memory handle used by the specified byte-array object.

Return value

S_OK

Indicates that the handle was returned successfully.

E_INVALIDARG

Indicates value specified for the pLkbyt parameter is not valid. It can also indicate that the byte array object passed in is not one created by the CreateILockBytesOnHGlobal function.

Remarks

After a call to CreateILockBytesOnHGlobal, which creates a byte array object on global memory, GetHGlobalFromILockBytes retrieves a pointer to the handle of the global memory underlying the byte array object. The handle this function returns might be different from the original handle due to intervening calls to the GlobalReAlloc function.

The contents of the returned memory handle can be written to a clean disk file, and then opened as a storage object using the StgOpenStorage function.

This function only works within the same process from which the byte array was created.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps | Windows Store apps]

Minimum supported server

Windows 2000 Server [desktop apps | Windows Store apps]

Header

Ole2.h

Library

Ole32.lib

DLL

Ole32.dll

See also

StgOpenStorage
CreateILockBytesOnHGlobal

 

 

社区附加资源

添加
显示:
© 2014 Microsoft