Re: [Quickfix-developers] Function problem in vb.net
Brought to you by:
orenmnero
|
From: cstrader <cst...@cs...> - 2006-11-16 02:27:42
|
Thanks to all.... I understand the issue now, although I still haven't = figured out how to deal with it! My problem, a bit off topic I suppose, = is that although textbox.invokerequired returns false, the textbox is = still not written to. chuck ----- Original Message -----=20 From: Brian Erst=20 To: cstrader ; qui...@li...=20 Sent: Wednesday, November 15, 2006 10:23 AM Subject: Re: [Quickfix-developers] Function problem in vb.net You're probably having a threading issue. The .NET framework controls = do not handle calls to them from other threads especially well = (sometimes they work, other times they don't). I'm just guessing here, but I'd guess the onCreate call is probably = running on your main thread (you instantiate a QF Application-derived = object, which creates the sessions, which call the "onCreate" callback), = while the onLogout is coming from the internal QF socket thread (this is = an asynchronous callback). The first one works because you are in the = "main" or "GUI" thread, while the second one fails because you are on a = different thread. I'm not sure how VB.NET handles this (I'm a C# guy myself), but in the = C# world you have to check the control's "InvokeRequired" property, and = if true, use its "Invoke" method to create a message that gets handled = by the GUI thread. A quick and dirty example: private delegate void SessionIDDelegate(SessionID sessionID); public void onLogout(SessionID sessionID) { // Are we on the main GUI thread? if (Form1.TextBox.InvokeRequired) { // No - call this function on the main GUI thread Form1.TextBox.Invoke(new SessionIDDelegate(onCreate), new = Object[]{sessionID}); } else { // We're on the main GUI thread - safe to update controls Console.Write("ONLOGOUT"); Form1.TextBox.Text =3D "LOGOUT"; } } Hope this helps. - Brian Erst Thynk Software, Inc. ----- Original Message ---- From: cstrader <cst...@cs...> To: qui...@li... Sent: Wednesday, November 15, 2006 8:21:13 AM Subject: [Quickfix-developers] Function problem in vb.net QuickFIX Documentation: = http://www.quickfixengine.org/quickfix/doc/html/index.html QuickFIX Support: http://www.quickfixengine.org/services.html I have a weird problem in vb.net 2005 that is causing me major = headaches. The problem is that some commands given within quickfix = functions do not execute. For instance, This sub writes to both the console and the textbox: Public Sub onCreate(ByVal sessionID As QuickFix.SessionID) Implements = QuickFix.Application.onCreate Console.write("ONCREATE") Form1.TextBox1.Text =3D "ONCREATE" End Sub But although this sub writes to the console, it does NOT write to = form1.textbox1!!! Public Sub onLogout(ByVal sessionID As QuickFix.SessionID) Implements = QuickFix.Application.onLogout=20 Console.write("ONLOGOUT") Form1.TextBox1.Text =3D "LOGOUT" End Sub Also, the ToApp sub is OK in this regard, but the FromApp sub does not = print to the textbox either??? thanks! chuck ----- Original Message -----=20 From: John Haldi=20 To: cstrader=20 Sent: Wednesday, October 25, 2006 9:26 AM Subject: RE: Any luck? Its very common for NetAdmins to disable pinging from external IPs. = But you need to get the broker's IT guy on the phone and explain that = you're trying to connect to their FIX engine and see if he can determine = whether there are any permission issues preventing you from connecting. -------------------------------------------------------------------------= --- From: cstrader [mailto:cst...@cs...]=20 Sent: Wednesday, October 25, 2006 10:12 AM To: John Haldi Subject: Re: Any luck? No...but thanks for asking. If I can't ping the ip address my broker has given me, and there is = no reason that I can think of on my end, what do you think that means? ----- Original Message -----=20 From: John Haldi=20 To: cstrader=20 Sent: Wednesday, October 25, 2006 10:01 AM Subject: Any luck? -------------------------------------- John Haldi Allagash Trading, LLC 120 Broadway, 20th Floor New York, NY 10271 212.433.3958 jo...@al... = -------------------------------------------------------------------------= Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to = share your opinions on IT & business topics through brief surveys - and earn cash = http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV _______________________________________________ Quickfix-developers mailing list Qui...@li... https://lists.sourceforge.net/lists/listinfo/quickfix-developers |