2c4de5c4f4
- primo commit.
89 lines
2.0 KiB
C++
89 lines
2.0 KiB
C++
// EgtInterface.cpp: definisce le funzioni esportate per l'applicazione DLL.
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "/EgtDev/Include/EInAPI.h"
|
|
#include <string>
|
|
|
|
using namespace std ;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
double
|
|
__stdcall Summ( double dA, double dB)
|
|
{
|
|
return ( dA + dB) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
int
|
|
__stdcall Summ2( double& dA, double dB)
|
|
{
|
|
dA += dB ;
|
|
bool bOk = false ;
|
|
return ( bOk ? 1 : 0) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
int
|
|
__stdcall Append( const wchar_t* wsA, wchar_t*& wsB)
|
|
{
|
|
wstring wsMy = wsA + wstring( L"_dalC++") ;
|
|
wsB = _wcsdup( wsMy.c_str()) ;
|
|
return (( wsB == nullptr) ? 0 : 1) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
int
|
|
__stdcall FreeMemory( void* pMem)
|
|
{
|
|
if ( pMem == nullptr)
|
|
return 0 ;
|
|
free( pMem) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
int
|
|
__stdcall SetPoint( double ptP[3])
|
|
{
|
|
ptP[0] += 10 ;
|
|
ptP[1] += 20 ;
|
|
ptP[2] += 30 ;
|
|
|
|
return 1 ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
int
|
|
__stdcall OutText( HWND hWnd, const wchar_t* wsA)
|
|
{
|
|
SetWindowText( hWnd, wsA) ;
|
|
|
|
return 1 ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
int
|
|
__stdcall DrawCross( HWND hWnd, int nX, int nY, int nDim)
|
|
{
|
|
RECT rc ;
|
|
GetClientRect( hWnd, &rc) ;
|
|
|
|
HDC hdc = GetDC( hWnd) ;
|
|
|
|
HGDIOBJ hPen = CreatePen( PS_SOLID, 1, RGB( 255,0,0)) ;
|
|
HGDIOBJ hPenOld = SelectObject( hdc, hPen) ;
|
|
|
|
MoveToEx( hdc, nX - nDim, nY, (LPPOINT) NULL) ;
|
|
LineTo( hdc, nX + nDim, nY);
|
|
MoveToEx( hdc, nX, nY - nDim, (LPPOINT) NULL) ;
|
|
LineTo( hdc, nX, nY + nDim);
|
|
|
|
SelectObject( hdc, hPenOld) ;
|
|
DeleteObject( hPen) ;
|
|
|
|
ReleaseDC( hWnd, hdc) ;
|
|
|
|
return 1 ;
|
|
}
|