dear experts,
I'm trying to integrate eSignal 7.5 inside a simple Java application.
I need help about a simple problem that occours everytime I start eSignal from my java application.
These are the steps I followed:
1. Run j2cgen.exe against IESignal 1.0 library (see j2cgen.gif attachment) including all Interfaces
2. Create the java class UseHooks that implements _IHooksEvents_If
3. Running UseHooks
This is the java code:
package it.soltec.t3.ie_signal;
import com.neva.COMClassObject;
import com.neva.COMException;
import com.neva.COMHResult;
import com.neva.COMIConnectionPoint;
import com.neva.COMIConnectionPointContainer;
import com.neva.COMSafeArray;
import com.neva.COMStdDispatch;
import com.neva.GUID;
public class UseHooks implements _IHooksEvents_If{
public IHooks m_object;
private COMIConnectionPoint m_cp;
private COMStdDispatch m_dspSink;
public int m_cpCookie;
COMIConnectionPointContainer cpc;
public UseHooks() throws Exception {
createObject();
}
private void createObject() throws Exception{
m_object = new IHooks();
GUID clsid = GUID.CLSIDFromProgID("IESignal.Hooks");
m_object.CoCreateInstance(clsid,COMClassObject.LOC AL_SERVER);
cpc = new COMIConnectionPointContainer();
m_object.QueryInterface(cpc);
m_cp = cpc.FindConnectionPoint(_IHooksEvents_If.IID);
cpc.Release();
m_dspSink = _IHooksEvents.BuildDispinterfaceSink(this);
m_cpCookie = m_cp.Advise(m_dspSink);
System.out.println(m_object.GetGetAppBuildNumber() );
System.out.println(m_object.GetGetAppVersion());
System.out.println(m_object.GetGetAppTime());
}
public static void main(String[] args) {
try {
COMClassObject.CoInitialize(COMClassObject.MULTITH READED);
UseHooks me = new UseHooks();
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnSymbolCh anged(java.lang.String)
*/
public COMHResult OnSymbolChanged(String _sSymbol) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnQuoteCha nged(java.lang.String)
*/
public COMHResult OnQuoteChanged(String _sSymbol) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnBarsChan ged(int)
*/
public COMHResult OnBarsChanged(int _lHandle) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnBarsRece ived(int)
*/
public COMHResult OnBarsReceived(int _lHandle) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnPlaceOrd er(java.lang.String)
*/
public COMHResult OnPlaceOrder(String _sXML) {
System.out.println(_sXML);
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnCancelAl lOrders()
*/
public COMHResult OnCancelAllOrders() {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnCancelOr derByOrderID(java.lang.String)
*/
public COMHResult OnCancelOrderByOrderID(String _sOrderID) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnCancelOr der(java.lang.String)
*/
public COMHResult OnCancelOrder(String _sSymbol) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnClosePos ition(java.lang.String)
*/
public COMHResult OnClosePosition(String _sSymbol) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnCloseAll Positions()
*/
public COMHResult OnCloseAllPositions() {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnCancelAn dReplace(java.lang.String, double, double, double)
*/
public COMHResult OnCancelAndReplace(String _sOrderID, double _dQuantity, double _dLimitPrice, double _dStopPrice) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnTimeSale sChanged(int)
*/
public COMHResult OnTimeSalesChanged(int _lHandle) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnWindowOp en(int, int, int)
*/
public COMHResult OnWindowOpen(int _hWND, int _hParentWnd, int _wtf) {
System.out.println("OnWindowOpen");
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnWindowCl osing(int, int, int)
*/
public COMHResult OnWindowClosing(int _hWND, int _hParentWnd, int _wtf) {
System.out.println("OnWindowClosing");
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnWindowPo sChanging(int, int, int)
*/
public COMHResult OnWindowPosChanging(int _hWND, int _hParentWnd, int _wtf) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnSavingLa youtOrPage(java.lang.String)
*/
public COMHResult OnSavingLayoutOrPage(String _sLayout) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnLoadingL ayoutOrPage(java.lang.String)
*/
public COMHResult OnLoadingLayoutOrPage(String _sLayout) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnAppClosi ng()
*/
public COMHResult OnAppClosing() {
System.out.println("OnAppClosing");
try {
m_cp.Unadvise(m_cpCookie);
m_cp.Release();
m_dspSink.Release();
} catch (COMException e) {
e.printStackTrace();
}
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnSymbolGr oupChangeEvent(java.lang.String, int, int)
*/
public COMHResult OnSymbolGroupChangeEvent(String _sSymbol, int _lGroupNum, int _crGroupColor) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnInterval GroupChangeEvent(java.lang.String, int, int)
*/
public COMHResult OnIntervalGroupChangeEvent(String _sSymbol, int _lGroupNum, int _crGroupColor) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnWindowSy mbolChange(int, int, java.lang.String, int)
*/
public COMHResult OnWindowSymbolChange(int _hWND, int _hParentWnd, String _sSymbol, int _wtf) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnBrokerMa inMenuCommand(java.lang.String)
*/
public COMHResult OnBrokerMainMenuCommand(String _sMenuCommandKey) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnBrokerCo ntextMenuCommand(java.lang.String, com.neva.COMSafeArray[])
*/
public COMHResult OnBrokerContextMenuCommand(String _sContextCommandKey, COMSafeArray[] _ppsaRowKeys) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnBrokerRo wDblClick(java.lang.String, java.lang.String)
*/
public COMHResult OnBrokerRowDblClick(String _sCategoryKey, String _sRowKey) {
return null;
}
}
When I run UseHooks, eSignal starts correctly but, when I exit from eSignal, I see the winsig.exe process already active in the windows task manager.
How can I fix this problem?
Thanks in advance
best regards
Giovanni Regola
I'm trying to integrate eSignal 7.5 inside a simple Java application.
I need help about a simple problem that occours everytime I start eSignal from my java application.
These are the steps I followed:
1. Run j2cgen.exe against IESignal 1.0 library (see j2cgen.gif attachment) including all Interfaces
2. Create the java class UseHooks that implements _IHooksEvents_If
3. Running UseHooks
This is the java code:
package it.soltec.t3.ie_signal;
import com.neva.COMClassObject;
import com.neva.COMException;
import com.neva.COMHResult;
import com.neva.COMIConnectionPoint;
import com.neva.COMIConnectionPointContainer;
import com.neva.COMSafeArray;
import com.neva.COMStdDispatch;
import com.neva.GUID;
public class UseHooks implements _IHooksEvents_If{
public IHooks m_object;
private COMIConnectionPoint m_cp;
private COMStdDispatch m_dspSink;
public int m_cpCookie;
COMIConnectionPointContainer cpc;
public UseHooks() throws Exception {
createObject();
}
private void createObject() throws Exception{
m_object = new IHooks();
GUID clsid = GUID.CLSIDFromProgID("IESignal.Hooks");
m_object.CoCreateInstance(clsid,COMClassObject.LOC AL_SERVER);
cpc = new COMIConnectionPointContainer();
m_object.QueryInterface(cpc);
m_cp = cpc.FindConnectionPoint(_IHooksEvents_If.IID);
cpc.Release();
m_dspSink = _IHooksEvents.BuildDispinterfaceSink(this);
m_cpCookie = m_cp.Advise(m_dspSink);
System.out.println(m_object.GetGetAppBuildNumber() );
System.out.println(m_object.GetGetAppVersion());
System.out.println(m_object.GetGetAppTime());
}
public static void main(String[] args) {
try {
COMClassObject.CoInitialize(COMClassObject.MULTITH READED);
UseHooks me = new UseHooks();
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnSymbolCh anged(java.lang.String)
*/
public COMHResult OnSymbolChanged(String _sSymbol) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnQuoteCha nged(java.lang.String)
*/
public COMHResult OnQuoteChanged(String _sSymbol) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnBarsChan ged(int)
*/
public COMHResult OnBarsChanged(int _lHandle) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnBarsRece ived(int)
*/
public COMHResult OnBarsReceived(int _lHandle) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnPlaceOrd er(java.lang.String)
*/
public COMHResult OnPlaceOrder(String _sXML) {
System.out.println(_sXML);
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnCancelAl lOrders()
*/
public COMHResult OnCancelAllOrders() {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnCancelOr derByOrderID(java.lang.String)
*/
public COMHResult OnCancelOrderByOrderID(String _sOrderID) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnCancelOr der(java.lang.String)
*/
public COMHResult OnCancelOrder(String _sSymbol) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnClosePos ition(java.lang.String)
*/
public COMHResult OnClosePosition(String _sSymbol) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnCloseAll Positions()
*/
public COMHResult OnCloseAllPositions() {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnCancelAn dReplace(java.lang.String, double, double, double)
*/
public COMHResult OnCancelAndReplace(String _sOrderID, double _dQuantity, double _dLimitPrice, double _dStopPrice) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnTimeSale sChanged(int)
*/
public COMHResult OnTimeSalesChanged(int _lHandle) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnWindowOp en(int, int, int)
*/
public COMHResult OnWindowOpen(int _hWND, int _hParentWnd, int _wtf) {
System.out.println("OnWindowOpen");
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnWindowCl osing(int, int, int)
*/
public COMHResult OnWindowClosing(int _hWND, int _hParentWnd, int _wtf) {
System.out.println("OnWindowClosing");
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnWindowPo sChanging(int, int, int)
*/
public COMHResult OnWindowPosChanging(int _hWND, int _hParentWnd, int _wtf) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnSavingLa youtOrPage(java.lang.String)
*/
public COMHResult OnSavingLayoutOrPage(String _sLayout) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnLoadingL ayoutOrPage(java.lang.String)
*/
public COMHResult OnLoadingLayoutOrPage(String _sLayout) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnAppClosi ng()
*/
public COMHResult OnAppClosing() {
System.out.println("OnAppClosing");
try {
m_cp.Unadvise(m_cpCookie);
m_cp.Release();
m_dspSink.Release();
} catch (COMException e) {
e.printStackTrace();
}
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnSymbolGr oupChangeEvent(java.lang.String, int, int)
*/
public COMHResult OnSymbolGroupChangeEvent(String _sSymbol, int _lGroupNum, int _crGroupColor) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnInterval GroupChangeEvent(java.lang.String, int, int)
*/
public COMHResult OnIntervalGroupChangeEvent(String _sSymbol, int _lGroupNum, int _crGroupColor) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnWindowSy mbolChange(int, int, java.lang.String, int)
*/
public COMHResult OnWindowSymbolChange(int _hWND, int _hParentWnd, String _sSymbol, int _wtf) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnBrokerMa inMenuCommand(java.lang.String)
*/
public COMHResult OnBrokerMainMenuCommand(String _sMenuCommandKey) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnBrokerCo ntextMenuCommand(java.lang.String, com.neva.COMSafeArray[])
*/
public COMHResult OnBrokerContextMenuCommand(String _sContextCommandKey, COMSafeArray[] _ppsaRowKeys) {
return null;
}
/* (non-Javadoc)
* @see it.soltec.t3.ie_signal._IHooksEvents_If#OnBrokerRo wDblClick(java.lang.String, java.lang.String)
*/
public COMHResult OnBrokerRowDblClick(String _sCategoryKey, String _sRowKey) {
return null;
}
}
When I run UseHooks, eSignal starts correctly but, when I exit from eSignal, I see the winsig.exe process already active in the windows task manager.
How can I fix this problem?
Thanks in advance
best regards
Giovanni Regola
Comment