好了,我大致的翻译了一下,你再试试。注意:把代码复制后另存为.dpr文件即可编译运行,不要别的什么窗体之类的东东了,再次祝您好运!program MultiTouSDK;uses Windows, Messages, SysUtils;type MTouchPoint = packed record x1: Integer; y1: Integer; x2: Integer; y2: Integer; end;type _TouchData = record dwTouchCount: DWORD; x1: DWORD; y1: DWORD; x2: DWORD; y2: DWORD; end; PointData = array[0..1] of _TouchData;const AppName = 'MultiTouSDK';var AppWnd: HWND; Msg: TMsg; WndClass: TWndClass; gBrBackground: HBRUSH; gCount: Integer = 0; gP1, gP2: MTouchPoint; function StartComDevice(nport: Integer; bTransform: Boolean): Integer; cdecl; external 'MultiTouchSDK.dll'; function RegistCallback(hMultTouchCallBack: PChar): Integer; cdecl; external 'MultiTouchSDK.dll'; function StopComDevice(): Integer; cdecl; external 'MultiTouchSDK.dll';function MultTouchCallBack(const pd: PointData; Cnt: Integer): Integer; stdcall; // 用 stdcall 定义回调函数var Rect: TRect; Scx, Scy: Integer;begin Scx := GetSystemMetrics(SM_CXSCREEN); Scy := GetSystemMetrics(SM_CYSCREEN); Rect.Left := 0; Rect.Top := 0; Rect.Right := Scx; Rect.Bottom := Scy; // 注:每个点都有两对坐标,即左上角和右下角坐标 if Cnt > 0 then // Cnt表示触摸的点数,1表示单点点触摸 begin gP1.x1 := pd[0].x1; // 单点触摸时该点的左上角x轴坐标 gP1.x2 := pd[0].x2; // 单点触摸时该点的右下角x轴坐标 gP1.y1 := pd[0].y1; // 单点触摸时该点的左上角y轴坐标 gP1.y2 := pd[0].y2; // 单点触摸时该点的右下角y轴坐标 if Cnt > 1 then begin gP2.x1 := pd[1].x1; // 两点触摸时第二点的左上角x轴坐标 gP2.x2 := pd[1].x2; // 两点触摸时第二点的右下角x轴坐标 gP2.y1 := pd[1].y1; // 两点触摸时第二点的左上角y轴坐标 gP2.y2 := pd[1].y2; // 两点触摸时第二点的右下角y轴坐标 end; end; gCount := Cnt; InvalidateRect(AppWnd, @Rect, False); UpdateWindow(AppWnd); end;function WndProc(Wnd: HWND; Msg, wParam: Word; lParam: LongInt): LongInt; stdcall;var Rect: TRect; Scx, Scy: Integer; DC: HDC; Ps: TPaintStruct; hBrushY, hBrushOld: HBRUSH;begin case Msg of WM_DESTROY: begin StopComDevice(); // 触摸屏停止 PostQuitMessage(0); end; WM_KEYUP: if wParam = VK_ESCAPE then // 按下 ESC 键 PostQuitMessage(0); WM_COMMAND: if LOWORD(wParam) = WM_CLOSE then DestroyWindow(Wnd); WM_PAINT: begin DC := BeginPaint(Wnd, Ps); Scx := GetSystemMetrics(SM_CXSCREEN); Scy := GetSystemMetrics(SM_CYSCREEN); Rect.Left := 0; Rect.Top := 0; Rect.Right := Scx; Rect.Bottom := Scy; FillRect(DC, Rect, gBrBackground); SetTextColor(DC, RGB(255, 128, 64)); SetBkMode(DC, TRANSPARENT); TextOut(DC, Round(Rect.Right / 2 - 100), 20, 'Please press ESC key to cancel.', 31); hBrushY := CreateSolidBrush(RGB(255, 128, 64)); hBrushOld := HBRUSH(SelectObject(DC, hBrushY)); if gCount > 0 then begin Rect.Left := Round(gP1.x1 * Scx / 4096); Rect.Right := Round(gP1.x2 * Scx / 4096); Rect.Top := Round(gP1.y1 * Scy / 4096); Rect.Bottom := Round(gP1.y2 * Scy / 4096); Ellipse(DC, Rect.Left - 5, Rect.Top - 5, Rect.Right, Rect.Bottom); if gCount > 1 then begin Rect.Left := Round(gP2.x1 * Scx / 4096); Rect.Right := Round(gP2.x2 * Scx / 4096); Rect.Top := Round(gP2.y1 * Scy / 4096); Rect.Bottom := Round(gP2.y2 * Scy / 4096); Ellipse(DC, Rect.Left - 5, Rect.Top - 5, Rect.Right, Rect.Bottom); end; DeleteObject(hBrushY); DeleteObject(hBrushOld); end; EndPaint(Wnd, Ps); end; end; WndProc := DefWindowProc(Wnd, Msg, wParam, lParam);end; begin if FindWindow(AppName, nil) <> 0 then Halt; FillChar(WndClass, SizeOf(WndClass), 0); with WndClass do begin style := CS_HREDRAW or CS_VREDRAW; lpfnWndProc := @WndProc; // 取回调函数 WndProc 的地址 hInstance := SysInit.HInstance; // 实例句柄 hIcon := LoadIcon(hInstance, 'MAINICON'); hCursor := LoadCursor(hInstance, IDC_ARROW); lpszClassName := AppName; // 窗口类名 end; RegisterClass(WndClass); // 注册窗口类 gBrBackground := CreateSolidBrush(RGB(0, 128, 255)); AppWnd := CreateWindow(AppName, nil, WS_POPUP or WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), 0, 0, HInstance, nil); if AppWnd > 0 then begin ShowWindow(AppWnd, SW_NORMAL); UpdateWindow(AppWnd); RegistCallback(@MultTouchCallBack); // 注册回调函数 StartComDevice(0, True); // 启动 COM 口的触摸屏 end; while GetMessage(Msg, 0, 0, 0) do begin TranslateMessage(Msg); DispatchMessage(Msg); end;end.