Maybe this code help you. It's sample for printing with webbrowser control.
Best regards.Code:Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Declare Function SetFocusAPI Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long Declare Function GetFocus Lib "user32" () As Long Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long 'GetWindow constants Public Const GW_CHILD = 5 'GetWindowLong constants Public Const GWL_STYLE = (-16) Public Const WS_VSCROLL = &H200000 Sub SetFocusToBrowser(hBrowserHwnd As Long) Dim lStyle As Long Dim lResult As Long Dim hwnd As Long hwnd = hBrowserHwnd While (lResult = 0) And (hwnd <> 0) hwnd = GetWindow(hwnd, GW_CHILD) lStyle = GetWindowLong(hwnd, GWL_STYLE) lResult = lStyle And WS_VSCROLL Wend SetFocusAPI (hwnd) End Sub Private Sub Command1_Click() Dim hwnd As Long WebBrowser1.SetFocus hwnd = GetFocus SetFocusToBrowser (hwnd) SendKeys "^P" 'Control-P to print End Sub
------------------
smalig
[email protected]
smalig.tripod.com




Reply With Quote