Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ILockBytes::SetSize method

The SetSize method changes the size of the byte array.

Syntax


HRESULT SetSize(
  [in]  ULARGE_INTEGER cb
);

Parameters

cb [in]

Specifies the new size of the byte array as a number of bytes.

Return value

This method can return one of these values.

S_OK

The size of the byte array was successfully changed.

STG_E_ACCESSDENIED

The caller does not have permission to access the byte array.

STG_E_MEDIUMFULL

The byte array size is not changed because there is no space left on the storage device.

Remarks

ILockBytes::SetSize changes the size of the byte array. If the cb parameter is larger than the current byte array, the byte array is extended to the indicated size by filling the intervening space with bytes of undefined value, as does ILockBytes::WriteAt, if the seek pointer is past the current end-of-stream.

If the cb parameter is smaller than the current byte array, the byte array is truncated to the indicated size.

Notes to Callers

Callers cannot rely on STG_E_MEDIUMFULL being returned at the appropriate time because of cache buffering in the operating system or network. However, callers must be able to deal with this return code because some ILockBytes implementations might support it.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps | Windows Store apps]

Minimum supported server

Windows 2000 Server [desktop apps | Windows Store apps]

Header

Objidl.h

IDL

Objidl.idl

Library

Uuid.lib

DLL

Ole32.dll

IID

IID_ILockBytes is defined as 0000000A-0000-0000-C000-000000000046

See also

ILockBytes::ReadAt
ILockBytes::WriteAt
ILockBytes - File-Based Implementation
ILockBytes - Global Memory Implementation

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.