Importing MSTSCAX as a VCL component is tricky, but I found a solution a couple of years ago which still works. ClientHeight, SWP_NOZORDER ) // SetForegroundWindow(WindowHandle) // SetFocus(WindowHandle) end Handle, GWL_STYLE ) or WS_CLIPCHILDREN ) /// Make the running app to fill all the client area of the container SetWindowPos ( _puttyhandle, 0, 0, 0, TWinControl ( _owner ). Handle, GWL_STYLE, GetWindowLong ( TWinControl ( _owner ). Handle, WM_UPDATEUISTATE, UIS_INITIALIZE, 0 ) UpdateWindow ( _puttyhandle ) /// This prevents the parent control to redraw on the area of its child windows (the running app) SetWindowLong ( TWinControl ( _owner ). Handle ) SendMessage ( TWinControl ( _owner ). SetParent ( _puttyhandle, TWinControl ( _owner ). FAppThreadID := GetWindowThreadProcessId ( _puttyhandle, nil ) AttachThreadInput ( GetCurrentThreadId, FAppThreadID, True ) /// Changing parent of the running app to our provided container control Windows. Dock var WindowStyle : Integer FAppThreadID : Cardinal begin WindowStyle := GetWindowLong ( _puttyhandle, GWL_STYLE ) WindowStyle := WindowStyle - WS_CAPTION - WS_BORDER - WS_OVERLAPPED - WS_THICKFRAME SetWindowLong ( _puttyhandle, GWL_STYLE, WindowStyle ) /// Attach container app input thread to the running app input thread, so that the running app receives user input. I docked Putty, but Notepad also works fine □ procedure TSSHConnection. _owner should be a TWinControl, where you want your external application to be docked. _puttyhandle is a THandle, value comes from FindWindow.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |