Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Programmatically press shift key
Message
 
À
11/01/2009 15:08:36
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01372663
Message ID:
01372674
Vues:
15
>>>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?
>>
>>See http://berezniker.com/content/pages/visual-foxpro/keyboard-input-virtual-key-codes
>>
>>I would guess we need to use SendKeys() function.
>>
>>Re: Send a Key Thread #1319460 Message #1319465
>
>Actually I got it working by using the keybd_event API, but thank you anyway. Here's the code, in case other face a similar problem:
>#DEFINE VKK_SHIFT                                               0x0010  && SHIFT KEY?
>#DEFINE VKK_CONTROL                                     0x0011  && CONTROL KEY?
>#DEFINE VKK_MENU                                                0x0012  && ALT KEY?
>#DEFINE VKK_START                                                0x005B  && START KEY? (Win Key)
>#DEFINE KEYEVENTF_KEYUP                         0x0002  && KEY UP
>DECLARE keybd_event IN WIN32API ;
>  INTEGER uVK, INTEGER uHardK, ;
>  INTEGER dwdata, INTEGER dwextra
>keybd_event(VKK_SHIFT,0, 0, 0)
>lox.document.all.Main.contentWindow.document.all.minf0.click()
I wish I read this before I posting :o)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform