ThisForm.oleBrowserWin.ExecWB(6, 1)The other case (the right mouse button click), still pending, but found the code below written by
#DEFINE MOUSEEVENTF_RIGHTDOWN 0x0008 DECLARE INTEGER mouse_event IN Win32API ; INTEGER, INTEGER, INTEGER, INTEGER, INTEGER DOEVENTS && make sure everything else is done mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0) DOEVENTS CLEAR DLLS "mouse_event"Inserted the above code in place of the keybd_event sequence (commented below), but all I got was VFP freezing (below is the Craig Boyd's code).
PUBLIC oform1 oform1=NEWOBJECT("form1") oform1.Show RETURN DEFINE CLASS form1 AS form DoCreate = .T. Caption = "Form1" Name = "Form1" WindowState = 2 ADD OBJECT olecontrol1 AS olecontrol WITH ; Top = 0, ; Left = 0, ; Height = 204, ; Width = 375, ; Anchor = 15, ; Name = "Olecontrol1", ; OleClass = "Shell.Explorer.2" ADD OBJECT command1 AS commandbutton WITH ; Top = 215, ; Left = 276, ; Height = 27, ; Width = 84, ; Anchor = 12, ; Caption = "Find", ; Name = "Command1" PROCEDURE olecontrol1.Init this.navigate("http://www.sweetpotatosoftware.com/spsblog") ENDPROC PROCEDURE command1.Click LOCAL loDoc loDoc = THISFORM.Olecontrol1.object.Document loDoc.focus() && document must have focus *!* Use API calls to simulate CTRL + F * ===== This starts where I replaced the code =========================== * #DEFINE KEYEVENTF_KEYUP 0x02 * #DEFINE VK_CONTROL 0x11 * * DECLARE INTEGER keybd_event IN Win32API ; * INTEGER, INTEGER, INTEGER, INTEGER * * DOEVENTS && make sure everything else is done * keybd_event(VK_CONTROL, 0, 0, 0) * keybd_event(0x46, 0, 0, 0) && 0x46 is 'f' * keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0) * DOEVENTS && make sure it sends the keys right now * * CLEAR DLLS "keybd_event" * ===== This ends where I replaced the code ============================= *!* Keyboard doesn't work here *!* KEYBOARD '{CTRL+F}' *!* We could have used Windows Script instead though *!* WshShell = CreateObject("WScript.Shell") *!* WshShell.SendKeys("^f") *!* OTHER DEV NOTES OF INTEREST *!* *!* ExecWB throws the following exception: *!* 'OLE Error code Trying to revoke a drop target that has not been registered' *!* THISFORM.Olecontrol1.ExecWB(42,0) *!* For some reason Microsoft didn't implement *!* the find dialog for execCommand *!* List of supported command identifiers can be found at: *!* http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/commandids.asp *!* loDoc.execCommand("Find") && this doesn't work, but others will ENDPROC ENDDEFINE