>>Could someone try turning this code from VB into VFP.
>
>Best I could do, without knowing what WebBrowser1 is? I assume it is instantiated in the form?
>
>Also, don't know how to translate SendKeys...
>
SendKeys would have to be translated into a SendMessage() or PostMessage() API invocation.
#DECLARE below should be
#DEFINE instead in VFP.
VFP indicates that a numeric constant is specified with hex notation by prefixing with 0x
blah rather than &H
blah, and the prefix &, which casts the value as a 32 bit integer in VB, doesn't have a direct equivalent in VFP; VFP casts numeric values passed in API calls in the format specified in the DECLARE...DLL statement.
An API call, even one that doesn't take any arguments, needs a trailing
() to indicate that a function, method or API call is invoked, otherwise, VFP's going to assume that it's a variable reference.
>
>#DECLARE GW_CHILD 5
>#DECLARE GWL_STYLE (-16)
>#DECLARE WS_VSCROLL &H200000
>
>Declare Long GetWindow Lib "user32" Long hwnd, Long wCmd
>Declare Long GetWindowLong Lib "user32" As "GetWindowLongA" Long hwnd, Long nIndex
>Declare Long SetFocusAPI Lib "user32" As "SetFocus" Long hwnd
>Declare Long GetFocus Lib "user32"
>Declare Long SendMessage Lib "user32" As "SendMessageA" Long hwnd, Long wMsg, Long wParam, Long lParam
>
>local hwnd
>
>WebBrowser1.SetFocus
>hwnd = GetFocus
>SetFocusToBrowser (hwnd)
>SendKeys "^P" 'Control-P to print
>End Sub
>
>
>FUNCTION SetFocusToBrowser(hBrowserHwnd)
>Local lStyle, ;
> lResult,;
> hwnd
>hwnd = hBrowserHwnd
>Do While (lResult = 0) And (hwnd <> 0)
> hwnd = GetWindow(hwnd, GW_CHILD)
> lStyle = GetWindowLong(hwnd, GWL_STYLE)
> lResult = lStyle And WS_VSCROLL
>EndDo
>SetFocusAPI (hwnd)
>EndFunc
>