User Manual HTS Hengstler Terminal Server for Windows

Add to My manuals
31 Pages

advertisement

User Manual HTS Hengstler Terminal Server for Windows | Manualzz

{

CString result; static BYTE parms[] =

VTS_I4 VTS_I4;

InvokeHelper(0x5, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms,

File, Number); return result;

}

CString HengstlerTerminalServer::WriteFile(long File, long Number, LPCTSTR Value)

{

CString result; static BYTE parms[] =

VTS_I4 VTS_I4 VTS_BSTR;

InvokeHelper(0x6, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms,

File, Number, Value); return result;

}

hconnect.cpp:

// This example is taken from the Microsoft example CALCDRIV

// and has been modified for use with Hengstler Terminal Server

BOOL CDriverDlg::OnInitDialog()

{

CDialog::OnInitDialog();

// create the hts object that we'll drive through OLE automation

COleException e;

CLSID clsid; if (CLSIDFromProgID(OLESTR("Hengstler.TerminalServer.10"), &clsid) !=

NOERROR)

{

AfxMessageBox(IDP_UNABLE_TO_CREATE);

EndDialog(IDABORT); return FALSE;

}

// try to get the active hts before creating a new one

LPUNKNOWN lpUnk;

LPDISPATCH lpDispatch; if (GetActiveObject(clsid, NULL, &lpUnk) == NOERROR)

{

HRESULT hr = lpUnk->QueryInterface(IID_IDispatch,

(LPVOID*)&lpDispatch); lpUnk->Release(); if (hr == NOERROR) m_hts.AttachDispatch(lpDispatch, TRUE);

}

// if not dispatch ptr attached yet, need to create one if (m_hts.m_lpDispatch == NULL &&

!m_hts.CreateDispatch(clsid, &e))

{

AfxMessageBox(IDP_UNABLE_TO_CREATE);

EndDialog(IDABORT); return FALSE;

}

// read a counter register to test and see if it works

CString result = m_hts.ReadRegister(1,1);

// examine result in the debugger return TRUE; // return TRUE unless you set the focus to a control

}

Tuning

In order to suppress the overhead inside HTS which occurs during open device and close device operations upon each DDE or OLE request a trick can be applied. Append the following lines to the file hentmsrv.ini

(after terminating HTS):

hentmsrv.ini:

[MultiTasking]

DirectAccess=1

This modification should only be carried out if HTS is used exclusively by one application. Please watch the case of the letters.

HTS for Windows page 25

advertisement

Related manuals