Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programmatically press shift key
Message
 
To
11/01/2009 14:37:39
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01372663
Message ID:
01372673
Views:
18
>I have a project where I need to automate Internet Explorer to read data from a website. The data must be read from a page which is a popup page activated by clicking some text on the main URL. But since many users have disabled popups, I need to programmatically press the shift key before I programmatically press the text. Something like
>lox=Createobject('internetexplorer.application')
>lox.Navigate('http://www.someurl.com/somepage')
>if navcomplete(lox,lntime)
>   ** Press shift key
>   lox.document.all.Main.contentWindow.document.all.minf0.click()
>Endif
>Can someone help me with code to simulate that the shift key is pressed?

How about keybd_event API?
#define VK_SHIFT 0x10

*** From news2news
#define KEYEVENTF_KEYUP 2
DECLARE keybd_event IN user32;
    SHORT bVk,;
    SHORT bScan,;
    INTEGER dwFlags,;
    INTEGER dwExtraInfo

lox=Createobject('internetexplorer.application')
lox.Navigate('http://www.someurl.com/somepage')
if navcomplete(lox,lntime)
   =keybd_event(VK_SHIFT, 0, 0, 0)
    DOEVENTS
   lox.document.all.Main.contentWindow.document.all.minf0.click()
   =keybd_event(VK_SHIFT, 0,  KEYEVENTF_KEYUP, 0)
Endif
NOT TESTED!
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform