# GetUserEvent

int GetUserEvent (int waitMode, int *panelOrMenuBarHandle, int *controlOrMenuItemID);

## Purpose

Obtains the next commit event or programmer-defined event from the GetUserEvent queue. A commit event occurs when the user changes the state of a hot or validate control or selects a menu item.

Place programmer-defined events in the GetUserEvent queue by calling QueueUserEvent. Refer to QueueUserEvent for the range of valid programmer-defined event codes.

| Note When the User Interface Library handles an event that starts a tracking loop, such as the user pulling down a menu, GetUserEvent does not return until the tracking loop completes, even if you pass 0 as the waitMode parameter. In the case of pulling down a menu, the tracking loop does not complete until the user dismisses the menu. Consequently, do not call GetUserEvent in your program if you want to continue executing the subsequent lines of code even during a tracking loop.

## Parameters

Input
Name | Type | Description
waitMode | integer | If 1, GetUserEvent does not return until a commit event or programmer-defined event occurs. If 0, GetUserEvent returns immediately, whether or not a commit event or programmer-defined event has occurred.
Output
Name | Type | Description
panelOrMenuBarHandle | integer | The handle of the panel or menu bar on which the event occurred. Returns –1 if waitMode is zero and no event has occurred.
controlOrMenuItemID | integer | Returns the ID of the control or menu item on which the commit event occurred. Returns –1 if waitMode is zero and no event has occurred.

## Return Value

Name | Type | Description
eventStatus | integer | The event, if any, that occurred.
0 | No event.
1 | Commit event occurred.
1,000-10,000 | Event queued by QueueUserEvent.
Negative values indicate that an error occurred.