델파이에서 구현해보려고 DLL용 .h 파일을 .pas로 만들어보았다.
원본 SDK는 
http://www.inexio.co.kr/07_download/download02.html

에서 받을 수 있으며 ( http://www.inexio.co.kr/pdf/sdk/Nexio_SDK_v2000.zip ) 


기본적으로는 작동되는데, 몇 가지는 의심스럽긴 하다.


아무튼 필요하시면 그냥 쓰시고, 이상해서 고쳐쓰시거든 댓글로 알려주시면 감사하겠습니다.



/////////////////////////////////////////////////////////////////////////////
//
// file inexio_multi.h
//
//
//  Version 1.10
//
//  Copyright (C) 2005-  NEXIO Co., Ltd. All rights reserved
//
// Homepage : http://www.inexio.co.kr
//
/////////////////////////////////////////////////////////////////////////////




unit NexioPlug;

interface

uses Windows, Classes;

const
  MPT_TOUCH_UP = 0;
  MPT_TOUCH_DOWN = 1;
  MPT_TOUCH_MOVE = 2;

  MTOUCH_TOUCH_UP = (MPT_TOUCH_UP); //Touch Up   OutputMulti dwstate
  MTOUCH_TOUCH_DOWN = (MPT_TOUCH_DOWN); //Touch Down OutputMulti dwstate
  MTOUCH_TOUCH_MOVE = (MPT_TOUCH_MOVE); //Touch Move OutputMulti dwstate

  // MPointElement wStatus
  INACTIVE_COORDINATE = $0000;
  ACTIVE_COORDINATE = $0001;
  IMAGE_COORDINATE = $0002;
  REJECTED_COORDINATE = $0003;

  MAX_MPOINTELEMENT = 100;
  MAX_MPOINTELEMENT_V2 = 98;

  EVENT_ARRIVED = 0; //Event arrived
  TIME_WAS_OUT = 1; //Wait time was out
  UNKNOWN_ERR = 2; //Unknown error object

  NEXIO_ROTATE_0 = 0;
  NEXIO_ROTATE_L90 = 90;
  NEXIO_ROTATE_R90 = 270;
  NEXIO_ROTATE_180 = 180;
  NEXIO_ROTATE_360 = 360;
  NEXIO_ROTATE_MIRROR_V = 1;
  NEXIO_ROTATE_MIRROR_H = 2;
type
  TMPointElement = record
    // Screen Coordinate (x,y) state
    // INACTIVE_COORDINATE, ACTIVE_COORDINATE, IMAGE_COORDINATE
    wStatus: WORD;
    wIndex: WORD; // ID of point

    // Pressed touch point width at screen coordinate (x,y)
    wXLength: WORD;
    // Pressed touch point height at screen coordinate (x,y)
    wYLength: WORD;

    wXWidth: WORD; // Reserved
    wYWidth: WORD; // Reserved

    // Pressed touch x point  at screen coordinate (x,y)
    wX: WORD;
    // Pressed touch y point  at screen coordinate (x,y)
    wY: WORD;

    wXStart: WORD;   // Reserved
    wXEnd: WORD;     // Reserved

    wYStart: WORD;   // Reserved
    wYEnd: WORD;     // Reserved
  end;




  POutputMulti = ^TOutputMulti;
  TOutputMulti = record
    // Multi-touch state
    // MPT_TOUCH_UP, MPT_TOUCH_DOWN, MPT_TOUCH_MOVE
    dwState : DWORD;

    // MAX( mX, mY)
    dwNumber : DWORD;
    // Total X coordinate count
    mX : DWORD;
    // Total Y coordinate count
    mY : DWORD;

    case Integer of
      0: (mPpointsOld : Array [0 .. MAX_MPOINTELEMENT - 1] of Array [0 .. MAX_MPOINTELEMENT - 1] of TMPointElement);
      1: (
//        mPpoints : Array[0 .. MAX_MPOINTELEMENT_V2 - 1] of Array [0 .. MAX_MPOINTELEMENT - 1] of TMPointElement;
        mPpoints : Array[0 .. MAX_MPOINTELEMENT - 1] of Array [0 .. MAX_MPOINTELEMENT_V2 - 1] of TMPointElement;
        sUsbID : Array[0 .. SizeOf(TMPointElement) * MAX_MPOINTELEMENT - 1] of char;

        wUsbID : WORD;
        wMonID : WORD;
        dwRESERVED00 : Array[0 .. 4] of DWORD;
        Reserved : Array[0 .. MAX_MPOINTELEMENT-2-1] of TMPointElement;
        dwRESERVED01 : Array[0 .. 5] of DWORD;
      );
  end;




//////////////////////////////////////////////////////////////////////////
//
// Function:    OpenNexioMulti
//
// Description:
//  Open Event of NEXIO Multi-Point TouchScreen coordinate
//
// Returns:
//  TRUE if Event Open successful, FALSE if Event fails....
//
//////////////////////////////////////////////////////////////////////////
//extern "C" __declspec(dllexport)
//BOOL __stdcall OpenNexioMulti();

function OpenNexioMulti: Boolean; stdcall; external 'MultiDll.dll' name 'OpenNexioMulti';




//////////////////////////////////////////////////////////////////////////
//
// Function:    WaitNexioMulti
//
// Description:
//  Wait Event and Touch Coordinate Output
//
// Input :
// nTime : [in] event wait time :: nTime is millisecond (INFINITE wait event infinite)
// Output :
// pBuffer : [out] pointer of touch coordinate
//
// Returns:
// EVENTARRIVED : Event arrived
// TIMEWASOUT : Wait time was out
// UNKNOWNERR : Unknown error object
//
//////////////////////////////////////////////////////////////////////////

//extern "C" __declspec(dllexport)
//int __stdcall WaitNexioMulti(DWORD nTime, OutputMulti *pBuffer);

function WaitNexioMulti(nTime: DWORD; pBuffer: POutputMulti): Integer; stdcall;  external 'MultiDll.dll' name 'WaitNexioMulti';

//////////////////////////////////////////////////////////////////////////
//
// Function:    CloseNexioMulti
//
// Description:
//  Close Event of NEXIO Multi-Point TouchScreen coordinate
//
//////////////////////////////////////////////////////////////////////////
//extern "C" __declspec(dllexport)
//void __stdcall CloseNexioMulti();
procedure CloseNexioMulti; stdcall; external 'MultiDll.dll' name 'CloseNexioMulti';





//////////////////////////////////////////////////////////////////////////
//
// Function:    NexioSetRotate
//
// Description:
//  set rotation of touch-screen
//  iRotateCode : NEXIO_ROTATE_XXX
//////////////////////////////////////////////////////////////////////////
//extern "C" __declspec(dllexport)
//void __stdcall NexioSetRotate( int iRotateCode );
procedure NexioSetRotate(iRotateCode: Integer); stdcall; external 'MultiDll.dll' name 'NexioSetRotate';





//////////////////////////////////////////////////////////////////////////
//
// Function:    NexioGetRotate
//
// Description:
//  get rotation code of touch-screen
//  return : NEXIO_ROTATE_XXX
//////////////////////////////////////////////////////////////////////////
//extern "C" __declspec(dllexport)
//DWORD __stdcall NexioGetRotate();
function NexioGetRotate: DWORD; stdcall; external 'MultiDll.dll' name 'NexioGetRotate';

implementation




// x,y : point for rotation
// mx, my : width, height of screen
// fRatio : mx / my ( ratio in float )
// dwRotateAngle : angle in degree (NEXIO_ROTATE_XXX)

procedure nxRoratePoint(var x, y: Integer; mx, my: Integer; fRatio: Real; dwRotateAngle: DWORD);
var
  x0, y0: Integer;
begin
x0 := x;
y0 := y;
case dwRotateAngle of
    NEXIO_ROTATE_0:
      Exit;
    NEXIO_ROTATE_L90:
    begin
      x := Trunc( mx - y0 * fRatio );
      y := Trunc( x0 / fRatio );
      Exit;
    end;
    NEXIO_ROTATE_180:
    begin
      x := Trunc( mx - x0);
      y := Trunc( my - y0);
      Exit;
    end;
    NEXIO_ROTATE_R90:
    begin
      x := Trunc( y0 * fRatio );
      y := Trunc( my - x0 / fRatio);
      Exit;
    end;
    NEXIO_ROTATE_360:
    begin
      x := Trunc( y0 * fRatio);
      y := Trunc( x0 / fRatio );
      Exit;
    end;
    NEXIO_ROTATE_MIRROR_V: //mirror vertical
    begin
      y := my - y0;
      Exit;
    end;
    NEXIO_ROTATE_MIRROR_H: //mirror horizontal
    begin
      x := mx - x0;
      Exit;
    end;
  end;

end;





end.
Posted by Parker Falcon

댓글을 달아주세요

  1. 2012.11.05 19:31
    댓글 주소 수정/삭제 댓글
    감사