Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VB HELP!
Message
From
20/05/1999 20:06:44
 
 
To
20/05/1999 19:46:45
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00221197
Message ID:
00221210
Views:
28
>>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 0xblah rather than &Hblah, 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
>
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform