Форум » [x]Harbour » [?] Datecs Ep-60 (SDK) » Ответить

[?] Datecs Ep-60 (SDK)

Dima: Есть SDK к принтеру http://datecs.bg/get_file.php?soft_id=49FD25D571CAD192F17BFCB200B0034A Возможно ли в Xharbour его заюзать ? Если возможно то с чего начинается родина ? Если можно то на примере вывода простого текста на печать. PS Ни когда еще не юзал какие либо SDK

Ответов - 42, стр: 1 2 3 All

Pasha: Надо написать модуль с wrapper-функциями: [pre]#include "hbapi.h" #include "printing.h" HB_FUNC( DTX_PRNOPEN ) { hb_retnl( PrnOpen( hb_parnl(1), hb_parnl(2), hb_parl(3)) ); } HB_FUNC( DTX_PRNCLOSE ) { hb_retnl( PrnClose() ); } HB_FUNC( DTX_PRNTEXT ) { hb_retnl( PrnText(hb_parc(1)) ); } HB_FUNC( DTX_PRNBARCODE ) { hb_retnl( PrnBarcode(hb_parnl(1), hb_parc(2), hb_parclen(2)) ); }[/pre] и так для каждой функции собирать программу с этим модулем, и с printing.lib

Dima: Pasha Спасибо большое !!!!!!! Буду пробовать.

Dima: Pasha Начал пробовать. Исходник [pre2] Proc main if dtx_propen(4,57600,.t.)==0 dtx_prntext("Блаблабла") dtx_prnclose() endif return #pragma BEGINDUMP #include "hbapi.h" #include "printing.h" HB_FUNC( DTX_PRNOPEN ) { hb_retnl( PrnOpen( hb_parnl(1), hb_parnl(2), hb_parl(3)) ); } HB_FUNC( DTX_PRNCLOSE ) { hb_retnl( PrnClose() ); } HB_FUNC( DTX_PRNTEXT ) { hb_retnl( PrnText(hb_parc(1)) ); } HB_FUNC( DTX_PRNBARCODE ) { hb_retnl( PrnBarcode(hb_parnl(1), hb_parc(2), hb_parclen(2)) ); } #pragma ENDDUMP [/pre2] Во время сборки получаю вот такую лажу , что делать ? [pre2] Building object module for 'obj\TEST.c' using C compiler 'BCC32' as defined in 'c:\x\bin\harbour.cfg'... Exec: BCC32 -c -D__EXPORT__ -Ic:\x\include -d -Lc:\x\lib -oobj\TEST.obj obj\TEST.c Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland obj\TEST.c: Error E2139 printing.h 116: Declaration missing ; Error E2238 printing.h 117: Multiple declaration for 'bool' Error E2344 printing.h 116: Earlier declaration of 'bool' Error E2139 printing.h 117: Declaration missing ; Error E2238 printing.h 118: Multiple declaration for 'bool' Error E2344 printing.h 116: Earlier declaration of 'bool' Error E2139 printing.h 118: Declaration missing ; Error E2238 printing.h 119: Multiple declaration for 'bool' Error E2344 printing.h 116: Earlier declaration of 'bool' Error E2139 printing.h 119: Declaration missing ; Error E2238 printing.h 120: Multiple declaration for 'bool' Error E2344 printing.h 116: Earlier declaration of 'bool' Error E2139 printing.h 120: Declaration missing ; Error E2238 printing.h 121: Multiple declaration for 'bool' Error E2344 printing.h 116: Earlier declaration of 'bool' Error E2139 printing.h 121: Declaration missing ; Error E2238 printing.h 122: Multiple declaration for 'bool' Error E2344 printing.h 116: Earlier declaration of 'bool' Error E2139 printing.h 122: Declaration missing ; Error E2238 printing.h 123: Multiple declaration for 'bool' Error E2344 printing.h 116: Earlier declaration of 'bool' Error E2139 printing.h 123: Declaration missing ; Error E2238 printing.h 124: Multiple declaration for 'bool' Error E2344 printing.h 116: Earlier declaration of 'bool' Error E2139 printing.h 124: Declaration missing ; Error E2228 printing.h 124: Too many error or warning messages *** 26 errors in Compile *** Done. Deleting: "obj\TEST.c" Done. [/pre2] [pre2] typedef struct PRINTER_INFORMATION { char name[23]; int printer; int fwver; int langver; int pagewidth; int maxlogoheight; int maxlogosize; int feedlines; bool irda; // 116 строка Printing.h bool msr; bool msr3track; bool katakana; bool shiftjis; bool fahrenheit; bool bluetooth; bool firmwareupdate; bool korean; bool blackmark; bool barcodereader; bool usba; bool usbb; bool sw1; bool sw2; bool sw3; bool sw4; bool sw5; bool sw6; bool sw7; bool sw8; bool sw9; bool sw10; bool sw11; bool sw12; bool sw13; bool sw14; bool sw15; bool sw16; bool sw17; bool sw18; bool sw19; bool sw20; bool universalreader; }PRINTER_INFORMATION; [/pre2]


Pasha: там используется тип bool, который bcc не знает. Надо перед строкой #include "printing.h" вставить строку typedef unsigned char bool; я думаю, unsigned char это и есть bool. Во всяком случае, в паскалевском модуле это тип Boolean

Dima: Сделал так [pre2] #include "hbapi.h" typedef unsigned char bool; #include "printing.h" HB_FUNC( DTX_PRNOPEN ) { hb_retnl( PrnOpen( hb_parnl(1), hb_parnl(2), hb_parl(3)) ); } HB_FUNC( DTX_PRNCLOSE ) { hb_retnl( PrnClose() ); } HB_FUNC( DTX_PRNTEXT ) { hb_retnl( PrnText(hb_parc(1)) ); } HB_FUNC( DTX_PRNBARCODE ) { hb_retnl( PrnBarcode(hb_parnl(1), hb_parc(2), hb_parclen(2)) ); } #pragma ENDDUMP [/pre2] Теперь получаю следующее Error E2040 printing.h 194: Declaration terminated incorrectly Error E2040 printing.h 210: Declaration terminated incorrectly Error E2040 printing.h 223: Declaration terminated incorrectly Error E2040 printing.h 270: Declaration terminated incorrectly Error E2040 printing.h 279: Declaration terminated incorrectly Error E2040 printing.h 287: Declaration terminated incorrectly Error E2040 printing.h 305: Declaration terminated incorrectly Error E2040 printing.h 318: Declaration terminated incorrectly Error E2040 printing.h 335: Declaration terminated incorrectly Error E2040 printing.h 355: Declaration terminated incorrectly Error E2040 printing.h 368: Declaration terminated incorrectly Error E2040 printing.h 382: Declaration terminated incorrectly Error E2040 printing.h 409: Declaration terminated incorrectly 194 строка extern "C" int __stdcall PrnOpen(int port, int speed, bool hardware);

Pasha: можно по-другому, просто поставить #define bool char

Dima: Pasha пишет: #define bool char Где это прописать ? Если прописывать вместо typedef unsigned char bool; тогда при сборке получаю Error E2040 TEST.PRG 10: Declaration terminated incorrectly

Dima: Dima пишет: Где это прописать ? Разобрался. Думал что закоментарил *typedef unsigned char bool; Но все равно Dima пишет: Error E2040 printing.h 194: Declaration terminated incorrectly Error E2040 printing.h 210: Declaration terminated incorrectly Error E2040 printing.h 223: Declaration terminated incorrectly Error E2040 printing.h 270: Declaration terminated incorrectly Error E2040 printing.h 279: Declaration terminated incorrectly Error E2040 printing.h 287: Declaration terminated incorrectly Error E2040 printing.h 305: Declaration terminated incorrectly Error E2040 printing.h 318: Declaration terminated incorrectly Error E2040 printing.h 335: Declaration terminated incorrectly Error E2040 printing.h 355: Declaration terminated incorrectly Error E2040 printing.h 368: Declaration terminated incorrectly Error E2040 printing.h 382: Declaration terminated incorrectly Error E2040 printing.h 409: Declaration terminated incorrectly 194 строка extern "C" int __stdcall PrnOpen(int port, int speed, bool hardware);

Pasha: Похоже, printing.h надо использовать в режиме c++ Те есть, создать модуль xxx.cpp, и собирать его компилятором bcc с параметром -P

Pasha: Можно, конечно, заменить во всем тексте extern "C" на extern

Dima: Pasha пишет: Можно, конечно, заменить во всем тексте extern "C" на extern Заменил , но теперь Error Printing.lib contains invalid OMF record ,type 0x21 (possibly COFF)

Dima: Допер ;) implib dtxprint.lib Printing.dll Принтер печатает :) Павел спасибо большое !!!!!!!!!!!!!!!!

Pasha: Дошли до линковки. Линкер поперхнулся либой И это поборем :) если либа не линкуется, то сделаем ее сами командой: implib printing.lib printing.dll

Pasha: У дураков мысли сходятся :)

Dima: Павел а как убрать из линковки библы , что бы все собралось Не нужны следующие dbfntx.lib dbffpt.lib hsx.lib hbsix.lib Хотелось бы максимум убрать все не используемые LIB , так как это будет прога которая будет получать на вход параметры и просто печатать на принтере. Запускать ее буду из Clipper

Петр: Dima пишет: dbfntx.lib dbffpt.lib hsx.lib hbsix.lib Как и в Clipper - ANNOUNCE RDDSYS

Dima: Петр Спасибо !!!

Dima: Что то застрял на ровном месте Программу вызываю из командной строки с параметрами Dtx 4 57600 test.txt Кусок исходника [pre2] Proc main() param nport,speed,cfile ? nport // 4 ? speed // 57600 ? cfile // test.txt if dtx_prnopen(nport,speed,.t.)==0 // не работает * так работает dtx_prnopen(4,57600,.t.) [/pre2]

Pasha: Dima пишет: if dtx_prnopen(nport,speed,.t.)==0 // не работает Наверное надо вызывать val(nport), val(speed)

Dima: Pasha Блин.............пойду проветрюсь Спасибо !



полная версия страницы