# DuplicateCtrl

int DuplicateCtrl (int sourcePanelHandle, int controlID, int destinationPanelHandle, char duplicateLabel[], int controlTop, int controlLeft);

## Purpose

Copies an existing control from the source panel to the destination panel and returns a control ID. You can use the control ID to reference the control in subsequent function calls.

## Parameters

Input
Name | Type | Description
sourcePanelHandle | integer | Handle of the source panel containing the control to duplicate. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel.
controlID | integer | The defined constant, located in the .uir header file, that you assigned to the control in the User Interface Editor, or the ID returned by NewCtrl or DuplicateCtrl.
destinationPanelHandle | integer | The parent panel into which to copy the duplicate control. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel.
duplicateLabel | string | Label for the duplicate control. Pass "" for no label. Pass 0 to use the label of the source control.
controlTop | integer | Vertical coordinate at which to place the upper left corner of the control, not including labels. The valid range for controlTop is –32,768 to 32,767 or VAL_KEEP_SAME_POSITION. The origin (0,0) is at the upper-left corner of the panel, directly below the title bar, before the panel is scrolled.
controlLeft | integer | Horizontal coordinate at which to place the upper left corner of the control, not including labels. The valid range for controlLeft is –32,768 to 32,767 or VAL_KEEP_SAME_POSITION. The origin (0,0) is at the upper-left corner of the panel, directly below the title bar, before the panel is scrolled.

## Return Value

Name | Type | Description
newID | integer | Returns the ID you use to specify the new (duplicate) control in subsequent function calls. Negative values indicate that an error occurred. Zero is not a valid ID.
Code | Error Message String
xx | Control ID (Success)