Based on the Embedding window into another process question I'm embedding an application which has only a TWebBrowser component on the main form, on my main application. Even I'm embedding it to a TScrollBox component the scroll bars don't appear when the main application is resizing. I've made some research on this issue, but without success. How can I enable the scrollbox's scrollbars?
LE: To clarify the question: Application A is a simple form with an TWebBrowser component on it. Application B, the main application, is embedding application A on a TScrollBox placed on a form, with Align set to alClient. Code for embedding A into B
procedure ShowAppEmbedded(WindowHandle: THandle; Container: TWinControl); var WindowStyle : Integer; FAppThreadID: Cardinal; begin /// Set running app window styles. WindowStyle := GetWindowLong(WindowHandle, GWL_STYLE); WindowStyle := WindowStyle - WS_CAPTION - WS_BORDER - WS_OVERLAPPED - WS_THICKFRAME; SetWindowLong(WindowHandle,GWL_STYLE,WindowStyle); /// Attach container app input thread to the running app input thread, so that /// the running app receives user input. FAppThreadID := GetWindowThreadProcessId(WindowHandle, nil); AttachThreadInput(GetCurrentThreadId, FAppThreadID, True); /// Changing parent of the running app to our provided container control Windows.SetParent(WindowHandle,Container.Handle); SendMessage(Container.Handle, WM_UPDATEUISTATE, UIS_INITIALIZE, 0); UpdateWindow(WindowHandle); /// This prevents the parent control to redraw on the area of its child windows (the running app) SetWindowLong(Container.Handle, GWL_STYLE, GetWindowLong(Container.Handle,GWL_STYLE) or WS_CLIPCHILDREN); /// Make the running app to fill all the client area of the container SetWindowPos(WindowHandle,0,0,0,Container.ClientWidth,Container.ClientHeight,SWP_NOZORDER); SetForegroundWindow(WindowHandle); end; When resizing the main application(B), the scrollbars of the TScrollBox component from B are not showed and the application A rests at it was set from the begging.
Solution: Based on Kobik's comment the application A is embedded into app B inside a TPanel aligned to alClient inside a TScrollBox. On the OnPanelResize event the following code is run:
if IsWindow(App_B_WindowHandle) then SetWindowPos(App_B_WindowHandle, 0, 0, 0, Panel1.Width, Panel1.Height, SWP_ASYNCWINDOWPOS);