Michel
开云体育Thanks
Carl.
I've
tried it in VB but it does not work.?I've not tried it with the login
window but with the 'connection confirmation' window there are various
problems.
In my
code, first I pass the focus to TWS (AppActivate) and then I try to send it keys
(SendKey) (ENTER key in this case).
First problem is when in your code you
issue a connection command (ActiveX.connect), TWS seems to catch you in a
program loop and dont return to your calling program until you manually click
'Yes' or 'No' in this window so any code after 'connect' (AppActivate and
SendKeys), simply dont execute.
To
turn around this problem, I made a separate litle?application
(IBActivation.exe) which simply makes this:
1-
Tempo 1 second.
2-
AppActivate "Stock and options..." (this is the title of the TWS
window)
3-
Tempo 1 second.
4-
SendKeys "{ENTER}"
Then
in my main code:
ShellExecute "IBActivation.exe"
TWS.connect
...
and get a system error when IBActivation.exe tries to activate and/or send keys.
(It works if TWS is runing normally, but not when presenting the 'connection
confirmation' window)!
So I
thought this behaviour was implemented by IB for some security reason to be sure
that a connection to the program is really made by the account owner. (There is
a security problem if you automate login and connection because everybody having
your program or access to your PC can connect to your
account).
?
Here I
am...
I'll
try this for the login window and post results here.
?
Thanks
again.
Michel.
?
[Michel]??-----Mensaje original----- De: Carl Erikson [mailto:carlerikson@...] Enviado el: martes, 02 de julio de 2002 22:24 Para: twsapi@... Asunto: Re: twsapi: automated login A hack is to send keystrokes to the login window. |