on 11/10/04 5:19 AM, Dan Cooper at dan dot cooper at xpsprint dot co dot uk
wrote:
> Here is the revised code, in the boxDraw event:
> if( hInstHandle == NULL ) {
> ControlData(pickerControl, instance, pickerData, data);
> REALwindow realWnd =
> REALGetControlWindow(REALGetControlParent(instance));
> HWND winRef = REALGetWindowHandle(realWnd);
> hInstHandle = (HINSTANCE)GetWindowLong(winRef, GWL_HINSTANCE);
> Rect rect;
> REALGetControlBounds(instance, &rect);
> hWindowHandle = CreateWindowEx(0, "SysDateTimePick32", 0,
> WS_CHILD + WS_BORDER + WS_VISIBLE, rect.left, rect.top, rect.right -
> rect.left, rect.bottom - rect.top, winRef, 0, hInstHandle, 0);
> BringWindowToTop(hWindowHandle);
> }
Right, if hInstance is derived from the controlParent then of course
hInstance will always be the same. In addition, you bypass the HWND-child RB
has already created for you. You may want to use this HWND-child to obtain
the hInstance, instead of the hwnd from the REALwindow.
Thus:
HINSTANCE hinstance =
(HINSTANCE)GetWindowLong(REALGetControlHWND(instance), GWL_HINSTANCE);
winRwf = REALgetControlHandle(instance);
wHwnd = CreateWindowEx( 0,
"SysDateTimePick32",
0,
WS_CHILD + WS_BORDER + WS_VISIBLE,
0,
0,
rect.right - rect.left,
rect.bottom - rect.top,
winRef,
0,
hInstHandle,
0
);
Now your wHwnd lives on the controlHWND and not on the REALwindow,
Alfred
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>
|