Michel,
what bee-jay-61 has done it was using Win Api's not the VB
code itself.
I'll post the code after i get around my problems and have
more time to do it.
Also, anyone running Proxy succesfully?? (Proxy from
AnalogX)
That's why I don't have the time.
David
toggle quoted message
Show quoted text
----- Original Message -----
Sent: Wednesday, July 03, 2002 7:33
PM
Subject: RE: twsapi: automated
login
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.
Pass your username as
separate keystrokes.? Then send
a tab key.? Then send your
password as separate
keystrokes.? Then send a return.? There is
a setting
to pre-fill the username in the .ini file (sorry,
no
pre-fill for the
password):
[Logon]
Username=edemo
.
.
.
If you
pre-filled in the username you can just send a
tab and then the password
plus a return key.? I send
characters to windows with Perl, but you
can do it in
almost any language (Visual Basic, C++).
I believe
you can detect when the "Accept incoming
connection" window pops
up.? If that is possible you
might just be able to send the enter
key to it to
accept the connection.? I haven't tried this
yet.
Good luck,
Carl
To
unsubscribe from this group, send an email
to:
twsapi-unsubscribe@...
Your use of
Yahoo! Groups is subject to the .