HeaderPane
Main
Hide
Share Link
Print

CopyItem

Copies an item to a new position.

C

LONG WINAPI SftBox_CopyItem(HWND hwndCtl, LONG from, LONG to);

C++

LONG CSftBox::CopyItem(LONG from, LONG to);

Parameters

hwndCtl

The window handle of the combo box control.

from

The zero-based index of the item to be copied.

to

The zero-based index of the position where the copied item is to be inserted. If to is -1 or is not the index of an existing item, the item is added at the end of the list.

Returns

The return value is the zero-based index of the new item or -1 if an error occurred.

Comments

The CopyItem function copies an item to a new position.

A new item is inserted at the position to. CopyItem copies all item attributes, including cell text, cell attributes, pictures, level, enabled/disabled status, row header contents, etc. Also copied is the value set using SetItemData. If this value should remain unique in an application, it has to be explicitly changed after copying the item.

Only the item from is copied. Its dependent items are not copied.

If the new item is inserted before the item from, the index of the original item increases by one.

If the dropdown portion of a dropdown or dropdown list combo box is visible, it is hidden when CopyItem is called. This can be suppressed using SetRollupOnChange.

An item can be moved using the MoveItem function.

In a combo box control using a virtual data source, this function cannot be used and an error is returned.

See Also C/C++ API | Categories | Notifications


Last Updated 11/21/2026 - (email)
© 2026 Softel vdm, Inc.