Join the 80,000 other DTN customers who enjoy the fastest, most reliable data available. There is no better value than DTN!

(Move your cursor to this area to pause scrolling)




"Awesome response, as usual. It is a sincere and refreshing pleasure to do business with DTN, compared to your competition." - Comment from Ryan
"It’s so nice to be working with real professionals!" - Comment from Len
"You have an excellent product !!!!!!" - Comment from Arely
"I would just like to say that IQFeed version 4 is running very well and I am very happy with its performance. I would also like to extend a big thanks for the fast and efficient help that I always receive. My questions and concerns are always addressed promptly. Way to go!" - Comment from Josh in CO.
"Thank God for your Data Feed as the only Zippers I see are on my pants (LOL), and no more 200 pip spikes to mess up charts." - Comment from Spiro via Email
"I had always used ******* but for the past 2 weeks have been trying DTN IQFeed. Customer support has been extraordinary. They call just to make sure your problem hasn't recurred." - Comment from Public Forum
"I am very happy I changed. I love the product, but more so I am thrilled with Tech Support. You are knowledgeable, polite, pleasant and professional." - Comment from Pat
"DTN has never given me problems. It is incredibly stable. In fact I've occasionally lost the data feed from Interactive Brokers, but still been able to trade because I'm getting good data from DTN." - Comment from Leighton
"I "bracket trade" all major news releases and I have not found one lag or glitch with DTN.IQ feed. I am very comfortable with their feed under all typical news conditions (Fed releases, employment numbers, etc)." - Comment from Public Forum
"And by the way, have to say this. I love the IQFeed software. It's rock solid and it has a really nice API." - Comment from Thomas via RT Chat
Home  Search  Register  Login  Recent Posts

Information on DTN's Industries:
DTN Oil & Gas | DTN Trading | DTN Agriculture | DTN Weather
Follow DTNMarkets on Twitter
DTN.IQ/IQFeed on Twitter
DTN News and Analysis on Twitter
»Forums Index »Archive (2017 and earlier) »IQFeed Developer Support »Not receiving WM_MOUSEMOVE Messages
Author Topic: Not receiving WM_MOUSEMOVE Messages (5 messages, Page 1 of 1)

kweiss
-Interested User-
Posts: 8
Joined: Mar 28, 2005


Posted: Mar 28, 2005 10:02 PM          Msg. 1 of 5
Hi! I don't appear to be receiving WM_MOUSEMOVE messages after I call RegisterClientApp (via the "Connect" method) from my C# program. I've included the code below. Hopefully you'll be able to see something I missed. Thanks....

--------------------------------------------------------------------------------------------

using System;
using System.Windows.Forms;
using System.Security.Permissions;
using System.Runtime.InteropServices;

namespace DtnFeed
{
public class IqFeed: NativeWindow
{
public enum Status
{
Unknown,
Connecting,
Connected,
Terminating,
Terminated
}

private int SUCCESS = 0;
private const int WM_MOUSEMOVE = 0x0200;
private const string DLL_NAME = "IQ32.DLL";

~IqFeed()
{
if(this.Handle != IntPtr.Zero)
this.DestroyHandle();
}

[DllImport(DLL_NAME, CallingConvention=CallingConvention.StdCall)]
private extern static int RegisterClientApp(IntPtr handle,
[MarshalAs(UnmanagedType.LPStr)] string productName,
[MarshalAs(UnmanagedType.LPStr)] string productKey,
[MarshalAs(UnmanagedType.LPStr)] string productVersion);

[DllImport(DLL_NAME, CallingConvention=CallingConvention.StdCall)]
private extern static void RemoveClientApp(IntPtr handle);

[DllImport(DLL_NAME, CallingConvention=CallingConvention.StdCall)]
private extern static int SetAutoLogin(
[MarshalAs(UnmanagedType.LPStr)] string userName,
[MarshalAs(UnmanagedType.LPStr)] string password);

public delegate void StatusEventHandler(object sender, Status status);

public event StatusEventHandler OnStatus;

public void Connect(string product, string key, string version,
string userName, string password)
{
CreateParams cp = new CreateParams();

this.CreateHandle(cp);

if(OnStatus != null)
OnStatus(this, Status.Connecting);

SetAutoLogin(userName, password);

if(RegisterClientApp(this.Handle, product, key, version) != SUCCESS)
throw new ApplicationException(); //Improve this
}

public void Terminate()
{
if(this.Handle != IntPtr.Zero)
{
if(OnStatus != null)
OnStatus(this, Status.Terminating);

RemoveClientApp(this.Handle);
}
}

protected override void WndProc(ref Message message)
{
if(message.Msg == WM_MOUSEMOVE)
{
uint x = (uint)message.LParam & 0xFFFF;
uint y = (uint)message.LParam >> 16;

if(OnStatus != null)
{
if((x == 0) && (y == 0))
OnStatus(this, Status.Connected);
else if((x == 0) && (y == 1))
OnStatus(this, Status.Unknown);
else if((x == 1) && (y == 0))
OnStatus(this, Status.Terminated);
else if((x == 1) && (y == 1))
OnStatus(this, Status.Terminating);
else
throw new ApplicationException();
}
}

base.WndProc(ref message);
}
}
}

DTN_Natalie_H
-DTN Evangelist-
Posts: 175
Joined: May 10, 2004

DTN Market Access, LLC.


Posted: Mar 31, 2005 08:53 AM          Msg. 2 of 5
I'll look into it and get back to you. In the meantime, you can look at the C# example app that is installed with the IQFeed developer package, if you haven't already done so. Thanks!

Natalie Hannan DTN Market Access, LLC.

DTN_Natalie_H
-DTN Evangelist-
Posts: 175
Joined: May 10, 2004

DTN Market Access, LLC.


Posted: Apr 7, 2005 09:39 AM          Msg. 3 of 5
Did looking at the example app help you? I don't see anything from looking at the code that you sent. Thanks!

Natalie Hannan DTN Market Access, LLC.

squirlhntr
-Interested User-
Posts: 62
Joined: Feb 12, 2005


Posted: May 1, 2005 12:26 PM          Msg. 4 of 5
Make sure iq32.dll and the other DLLs are not in the same directory as the application you are running. The code needs to reference the DLLs from the place they were installed by the installation program and if instead the code ends up using the DLL in the currect directory, for whatever reason you won't get the MOUSEMOVE messages.

swhitney
-Interested User-
Posts: 21
Joined: Nov 3, 2005


Posted: Nov 5, 2005 10:31 PM          Msg. 5 of 5
This Cracks the Nut Directly...and simply

This will open the IQ server and prime it for a socket connection in C#

</OCX>

//use appropriate marshalling resources
using System.Runtime.InteropServices;

//define a delegate
public delegate void CallBackDelegate(int x, int y);

//Explicit DLL function references
//reference the external call back function (make sure IQ32.dll is nearby or define a path)
//NOTE!!! -> WE PASS A LOCALLY DEFINED DELEGATE TYPE (CallBackDelegate type)
//Define your local reference to the external function with local object params...
[DllImport("IQ32.dll")]
public static extern void SetCallbackFunction(CallBackDelegate callback);
//define a local ref to the reg client function
[DllImport("IQ32.dll")]
public static extern int RegisterClientApp(IntPtr hClient, string szProductName,string szProductKey, string szProductVersion);

The following 3 called from Load or Initialize or whatever gets you going
//declare a  new call back delegate pointing to our local function [SLAVE]
CallBackDelegate callback = new CallBackDelegate(this.CallBack);

//send the delegate pointer to IQ****
SetCallbackFunction(callback);

//register the app, passing the main object pointer,name,key,ver
RegisterClientApp(this.Handle,strName,strKey,strVersion);

//poor little callback [SLAVE]	
private void CallBack(int x, int y)
{
// Do Somthing
string[,] callbackMsg =
{
{"Connection OK", "N/A"},
{"Offline Notification","IQFeed Terminating"}
};
Console.WriteLine(callbackMsg[x,y]);
};

**** Note: Create and Set in one swoop: SetCallbackFunction(new CallBackDelegate(this.CallBack));


Edited by swhitney on Nov 5, 2005 at 11:41 PM
 

 

Time: Sun May 19, 2024 3:21 PM CFBB v1.2.0 9 ms.
© AderSoftware 2002-2003