If you use the WinCreateStdWindow function to create a scroll bar as a child of the frame window, you must be able to retrieve the scroll-bar handle. One way to do this is to use the WinWindowFromID function, the frame-window handle, and a predefined identifier (such as FID_HORZSCROLL or FID_VERTSCROLL), as shown in the following code fragment:
HWND hwndFrame,hwndHorzScroll,hwndVertScroll;
hwndHorzScroll = WinWindowFromID(hwndFrame, FID_HORZSCROLL);
hwndVertScroll = WinWindowFromID(hwndFrame, FID_VERTSCROLL);
If the standard frame window includes a client window, you can use that handle to access the scroll bars. The idea is to get the frame-window handle first; then, the scroll-bar handle.
HWND hwndScroll,hwndClient;
/* Get a handle to the horizontal scroll bar. */
hwndScroll = WinWindowFromID(
WinQueryWindow(hwndClient, QW_PARENT),
FID_HORZSCROLL);