开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: twsapi: automated login


David
 

开云体育

this is the way to do it considering the situation
well done
David

----- Original Message -----
From: bee_jay_61
Sent: Wednesday, July 03, 2002 8:03 PM
Subject: Re: twsapi: automated login

That?s why I start a new separate thread in my program to confirm
the "Accept incomming connection attempt" dialog.

First I start the thread that searches the window for about 60
seconds (or more if you need). Than I call TWS.Connect from the main
thread while the child thread has allready began his search.

This call will force the TWS to display the dialog and than the child
thread can find this window. So the main thread (main program) is
never blocked like in your case.

It is not a security feature from IB.

BeeJay




--- In twsapi@y..., "Michel" wrote:
> 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@y...]
> Enviado el: martes, 02 de julio de 2002 22:24
> Para: twsapi@y...
> 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 .

Join [email protected] to automatically receive all group messages.