exports.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. //
  2. // Copyright 2002 Neil Van Eps
  3. //
  4. #include "stdafx.h"
  5. #include "exports.h"
  6. #include "Code39.h"
  7. #include "I2of5.h"
  8. #include "RationalCodabar.h"
  9. #include "Code128.h"
  10. #include "Code93.h"
  11. ////////////////////////////////////////////////////////////////////////////////////
  12. //
  13. // Name:
  14. // Code128BarcodeToClipboard()
  15. //
  16. // Description:
  17. // Puts a bitmap of the input code128 barcode on the clipboard
  18. //
  19. // Arguments:
  20. // CString csMessage
  21. // double dHeight
  22. // double dNarrowBar
  23. // long nCode128StartingSubset
  24. //
  25. // Return:
  26. // void
  27. //
  28. // Called by:
  29. // public DLL interface
  30. //
  31. ////////////////////////////////////////////////////////////////////////////////////
  32. void __declspec( dllexport ) Code128BarcodeToClipboard(CString csMessage,double dHeight,double dNarrowBar,long nCode128StartingSubset)
  33. {
  34. HDC hDC = NULL;
  35. CCode128 oBarcode;
  36. oBarcode.LoadData(csMessage,dNarrowBar,dHeight,hDC,0,0,nCode128StartingSubset);
  37. oBarcode.BitmapToClipboard();
  38. return;
  39. }
  40. ////////////////////////////////////////////////////////////////////////////////////
  41. //
  42. // Name:
  43. // DrawCode128Barcode()
  44. //
  45. // Description:
  46. // Draws the input code128 barcode to the screen
  47. //
  48. // Arguments:
  49. // CString csMessage
  50. // double dHeight
  51. // double dNarrowBar
  52. // HDC pDC
  53. // long nStartingXPixel
  54. // long nStartingYPixel
  55. // long nCode128StartingSubset
  56. //
  57. // Return:
  58. // void
  59. //
  60. // Called by:
  61. // public DLL interface
  62. //
  63. ////////////////////////////////////////////////////////////////////////////////////
  64. void __declspec( dllexport ) DrawCode128Barcode(CString csMessage,double dHeight,double dNarrowBar,HDC pDC,long nStartingXPixel,long nStartingYPixel,long nCode128StartingSubset)
  65. {
  66. CCode128 oBarcode;
  67. oBarcode.LoadData(csMessage,dNarrowBar,dHeight,pDC,nStartingXPixel,nStartingYPixel,nCode128StartingSubset);
  68. oBarcode.DrawBitmap();
  69. return;
  70. }
  71. ////////////////////////////////////////////////////////////////////////////////////
  72. //
  73. // Name:
  74. // GetCode128BarcodePixelWidth()
  75. //
  76. // Description:
  77. // Returns the length in pixels of the code128 barcode bitmap
  78. //
  79. // Arguments:
  80. // CString csMessage
  81. // double dNarrowBar
  82. // HDC pDC
  83. // long nCode128StartingSubset
  84. //
  85. // Return:
  86. // long - width in pixels of the code128 barcode bitmap
  87. //
  88. // Called by:
  89. // public DLL interface
  90. //
  91. ////////////////////////////////////////////////////////////////////////////////////
  92. long __declspec( dllexport ) GetCode128BarcodePixelWidth(CString csMessage, double dNarrowBar, HDC pDC, long nCode128StartingSubset)
  93. {
  94. long nPixelWidth;
  95. CCode128 oBarcode;
  96. oBarcode.LoadData(csMessage,dNarrowBar,1.0,pDC,0,0,nCode128StartingSubset);
  97. nPixelWidth = oBarcode.GetBarcodePixelWidth();
  98. return nPixelWidth;
  99. }
  100. ////////////////////////////////////////////////////////////////////////////////////
  101. //
  102. // Name:
  103. // ErrorCheckCode128Message()
  104. //
  105. // Description:
  106. // Error checks the input message to see if it is a legal code128 message
  107. //
  108. // Arguments:
  109. // CString csMessage
  110. // long nCode128StartingSubset
  111. //
  112. // Return:
  113. // BOOL - TRUE if a legal code128 message, FALSE if not a legal code128 message
  114. //
  115. // Called by:
  116. // public DLL interface
  117. //
  118. ////////////////////////////////////////////////////////////////////////////////////
  119. BOOL __declspec( dllexport ) ErrorCheckCode128Message(CString csMessage, long nCode128StartingSubset)
  120. {
  121. return TRUE;
  122. }
  123. ////////////////////////////////////////////////////////////////////////////////////
  124. //
  125. // Name:
  126. // Code39BarcodeToClipboard()
  127. //
  128. // Description:
  129. // Puts a bitmap of the input code39 barcode on the clipboard
  130. //
  131. // Arguments:
  132. // CString csMessage
  133. // double dHeight
  134. // double dNarrowBar
  135. // double dRatio
  136. //
  137. // Return:
  138. // void
  139. //
  140. // Called by:
  141. // public DLL interface
  142. //
  143. ////////////////////////////////////////////////////////////////////////////////////
  144. void __declspec( dllexport ) Code39BarcodeToClipboard(CString csMessage,double dHeight,double dNarrowBar,double dRatio)
  145. {
  146. HDC hDC = NULL;
  147. CCode39 oBarcode;
  148. oBarcode.LoadData(csMessage,dNarrowBar,dHeight,hDC,0,0,dRatio);
  149. oBarcode.BitmapToClipboard();
  150. return;
  151. }
  152. ////////////////////////////////////////////////////////////////////////////////////
  153. //
  154. // Name:
  155. // DrawCode39Barcode()
  156. //
  157. // Description:
  158. // Draws the input code39 barcode to the screen
  159. //
  160. // Arguments:
  161. // CString csMessage
  162. // double dHeight
  163. // double dNarrowBar
  164. // HDC pDC
  165. // long nStartingXPixel
  166. // long nStartingYPixel
  167. // double dRatio
  168. //
  169. // Return:
  170. // void
  171. //
  172. // Called by:
  173. // public DLL interface
  174. //
  175. ////////////////////////////////////////////////////////////////////////////////////
  176. void __declspec( dllexport ) DrawCode39Barcode(CString csMessage,double dHeight,double dNarrowBar,HDC pDC,long nStartingXPixel,long nStartingYPixel,double dRatio)
  177. {
  178. CCode39 oBarcode;
  179. oBarcode.LoadData(csMessage,dNarrowBar,dHeight,pDC,nStartingXPixel,nStartingYPixel,dRatio);
  180. oBarcode.DrawBitmap();
  181. return;
  182. }
  183. ////////////////////////////////////////////////////////////////////////////////////
  184. //
  185. // Name:
  186. // GetCode39BarcodePixelWidth()
  187. //
  188. // Description:
  189. // Returns the length in pixels of the code39 barcode bitmap
  190. //
  191. // Arguments:
  192. // CString csMessage
  193. // double dNarrowBar
  194. // HDC pDC
  195. // double dRatio
  196. //
  197. // Return:
  198. // long - width in pixels of the code39 barcode bitmap
  199. //
  200. // Called by:
  201. // public DLL interface
  202. //
  203. ////////////////////////////////////////////////////////////////////////////////////
  204. long __declspec( dllexport ) GetCode39BarcodePixelWidth(CString csMessage, double dNarrowBar, HDC pDC, double dRatio)
  205. {
  206. long nPixelWidth;
  207. CCode39 oBarcode;
  208. oBarcode.LoadData(csMessage,dNarrowBar,1.0,pDC,0,0,dRatio);
  209. nPixelWidth = oBarcode.GetBarcodePixelWidth();
  210. return nPixelWidth;
  211. }
  212. ////////////////////////////////////////////////////////////////////////////////////
  213. //
  214. // Name:
  215. // ErrorCheckCode39Message()
  216. //
  217. // Description:
  218. // Error checks the input message to see if it is a legal code39 message
  219. //
  220. // Arguments:
  221. // CString csMessage
  222. //
  223. // Return:
  224. // BOOL - TRUE if a legal code39 message, FALSE if not a legal code39 message
  225. //
  226. // Called by:
  227. // public DLL interface
  228. //
  229. ////////////////////////////////////////////////////////////////////////////////////
  230. BOOL __declspec( dllexport ) ErrorCheckCode39Message(CString csMessage)
  231. {
  232. return TRUE;
  233. }
  234. ////////////////////////////////////////////////////////////////////////////////////
  235. //
  236. // Name:
  237. // Code93BarcodeToClipboard()
  238. //
  239. // Description:
  240. // Puts a bitmap of the input code93 barcode on the clipboard
  241. //
  242. // Arguments:
  243. // CString csMessage
  244. // double dHeight
  245. // double dNarrowBar
  246. //
  247. // Return:
  248. // void
  249. //
  250. // Called by:
  251. // public DLL interface
  252. //
  253. ////////////////////////////////////////////////////////////////////////////////////
  254. void __declspec( dllexport ) Code93BarcodeToClipboard(CString csMessage,double dHeight,double dNarrowBar)
  255. {
  256. HDC hDC = NULL;
  257. CCode93 oBarcode;
  258. oBarcode.LoadData(csMessage,dNarrowBar,dHeight,hDC,0,0);
  259. oBarcode.BitmapToClipboard();
  260. return;
  261. }
  262. ////////////////////////////////////////////////////////////////////////////////////
  263. //
  264. // Name:
  265. // DrawCode93Barcode()
  266. //
  267. // Description:
  268. // Draws the input code93 barcode to the screen
  269. //
  270. // Arguments:
  271. // CString csMessage
  272. // double dHeight
  273. // double dNarrowBar
  274. // HDC pDC
  275. // long nStartingXPixel
  276. // long nStartingYPixel
  277. //
  278. // Return:
  279. // void
  280. //
  281. // Called by:
  282. // public DLL interface
  283. //
  284. ////////////////////////////////////////////////////////////////////////////////////
  285. void __declspec( dllexport ) DrawCode93Barcode(CString csMessage,double dHeight,double dNarrowBar,HDC pDC,long nStartingXPixel,long nStartingYPixel)
  286. {
  287. CCode93 oBarcode;
  288. oBarcode.LoadData(csMessage,dNarrowBar,dHeight,pDC,nStartingXPixel,nStartingYPixel);
  289. oBarcode.DrawBitmap();
  290. return;
  291. }
  292. ////////////////////////////////////////////////////////////////////////////////////
  293. //
  294. // Name:
  295. // GetCode93BarcodePixelWidth()
  296. //
  297. // Description:
  298. // Returns the length in pixels of the code93 barcode bitmap
  299. //
  300. // Arguments:
  301. // CString csMessage
  302. // double dNarrowBar
  303. // HDC pDC
  304. //
  305. // Return:
  306. // long - width in pixels of the code93 barcode bitmap
  307. //
  308. // Called by:
  309. // public DLL interface
  310. //
  311. ////////////////////////////////////////////////////////////////////////////////////
  312. long __declspec( dllexport ) GetCode93BarcodePixelWidth(CString csMessage, double dNarrowBar, HDC pDC)
  313. {
  314. long nPixelWidth;
  315. CCode93 oBarcode;
  316. oBarcode.LoadData(csMessage,dNarrowBar,1.0,pDC,0,0);
  317. nPixelWidth = oBarcode.GetBarcodePixelWidth();
  318. return nPixelWidth;
  319. }
  320. ////////////////////////////////////////////////////////////////////////////////////
  321. //
  322. // Name:
  323. // ErrorCheckCode93Message()
  324. //
  325. // Description:
  326. // Error checks the input message to see if it is a legal code93 message
  327. //
  328. // Arguments:
  329. // CString csMessage
  330. //
  331. // Return:
  332. // BOOL - TRUE if a legal code93 message, FALSE if not a legal code93 message
  333. //
  334. // Called by:
  335. // public DLL interface
  336. //
  337. ////////////////////////////////////////////////////////////////////////////////////
  338. BOOL __declspec( dllexport ) ErrorCheckCode93Message(CString csMessage)
  339. {
  340. return TRUE;
  341. }
  342. ////////////////////////////////////////////////////////////////////////////////////
  343. //
  344. // Name:
  345. // I2of5BarcodeToClipboard()
  346. //
  347. // Description:
  348. // Puts a bitmap of the input I2of5 barcode on the clipboard
  349. //
  350. // Arguments:
  351. // CString csMessage
  352. // double dHeight
  353. // double dNarrowBar
  354. // double dRatio
  355. //
  356. // Return:
  357. // void
  358. //
  359. // Called by:
  360. // public DLL interface
  361. //
  362. ////////////////////////////////////////////////////////////////////////////////////
  363. void __declspec( dllexport ) I2of5BarcodeToClipboard(CString csMessage,double dHeight,double dNarrowBar,double dRatio)
  364. {
  365. HDC hDC = NULL;
  366. CI2of5 oBarcode;
  367. oBarcode.LoadData(csMessage,dNarrowBar,dHeight,hDC,0,0,dRatio);
  368. oBarcode.BitmapToClipboard();
  369. return;
  370. }
  371. ////////////////////////////////////////////////////////////////////////////////////
  372. //
  373. // Name:
  374. // DrawI2of5Barcode()
  375. //
  376. // Description:
  377. // Draws the input I2of5 barcode to the screen
  378. //
  379. // Arguments:
  380. // CString csMessage
  381. // double dHeight
  382. // double dNarrowBar
  383. // HDC pDC
  384. // long nStartingXPixel
  385. // long nStartingYPixel
  386. // double dRatio
  387. //
  388. // Return:
  389. // void
  390. //
  391. // Called by:
  392. // public DLL interface
  393. //
  394. ////////////////////////////////////////////////////////////////////////////////////
  395. void __declspec( dllexport ) DrawI2of5Barcode(CString csMessage,double dHeight,double dNarrowBar,HDC pDC,long nStartingXPixel,long nStartingYPixel,double dRatio)
  396. {
  397. CI2of5 oBarcode;
  398. oBarcode.LoadData(csMessage,dNarrowBar,dHeight,pDC,nStartingXPixel,nStartingYPixel,dRatio);
  399. oBarcode.DrawBitmap();
  400. return;
  401. }
  402. ////////////////////////////////////////////////////////////////////////////////////
  403. //
  404. // Name:
  405. // GetI2of5BarcodePixelWidth()
  406. //
  407. // Description:
  408. // Returns the length in pixels of the I2of5 barcode bitmap
  409. //
  410. // Arguments:
  411. // CString csMessage
  412. // double dNarrowBar
  413. // HDC pDC
  414. // double dRatio
  415. //
  416. // Return:
  417. // long - width in pixels of the I2of5 barcode bitmap
  418. //
  419. // Called by:
  420. // public DLL interface
  421. //
  422. ////////////////////////////////////////////////////////////////////////////////////
  423. long __declspec( dllexport ) GetI2of5BarcodePixelWidth(CString csMessage, double dNarrowBar, HDC pDC, double dRatio)
  424. {
  425. long nPixelWidth;
  426. CI2of5 oBarcode;
  427. oBarcode.LoadData(csMessage,dNarrowBar,1.0,pDC,0,0,dRatio);
  428. nPixelWidth = oBarcode.GetBarcodePixelWidth();
  429. return nPixelWidth;
  430. }
  431. ////////////////////////////////////////////////////////////////////////////////////
  432. //
  433. // Name:
  434. // ErrorCheckI2of5Message()
  435. //
  436. // Description:
  437. // Error checks the input message to see if it is a legal I2of5 message
  438. //
  439. // Arguments:
  440. // CString csMessage
  441. //
  442. // Return:
  443. // BOOL - TRUE if a legal I2of5 message, FALSE if not a legal I2of5 message
  444. //
  445. // Called by:
  446. // public DLL interface
  447. //
  448. ////////////////////////////////////////////////////////////////////////////////////
  449. BOOL __declspec( dllexport ) ErrorCheckI2of5Message(CString csMessage)
  450. {
  451. return TRUE;
  452. }
  453. ////////////////////////////////////////////////////////////////////////////////////
  454. //
  455. // Name:
  456. // RationalCodabarBarcodeToClipboard()
  457. //
  458. // Description:
  459. // Puts a bitmap of the input rational codabar barcode on the clipboard
  460. //
  461. // Arguments:
  462. // CString csMessage
  463. // double dHeight
  464. // double dNarrowBar
  465. // double dRatio
  466. //
  467. // Return:
  468. // void
  469. //
  470. // Called by:
  471. // public DLL interface
  472. //
  473. ////////////////////////////////////////////////////////////////////////////////////
  474. void __declspec( dllexport ) RationalCodabarBarcodeToClipboard(CString csMessage,double dHeight,double dNarrowBar,double dRatio)
  475. {
  476. HDC hDC = NULL;
  477. CRationalCodabar oBarcode;
  478. oBarcode.LoadData(csMessage,dNarrowBar,dHeight,hDC,0,0,dRatio);
  479. oBarcode.BitmapToClipboard();
  480. return;
  481. }
  482. ////////////////////////////////////////////////////////////////////////////////////
  483. //
  484. // Name:
  485. // DrawRationalCodabarBarcode()
  486. //
  487. // Description:
  488. // Draws the input rational codabar barcode to the screen
  489. //
  490. // Arguments:
  491. // CString csMessage
  492. // double dHeight
  493. // double dNarrowBar
  494. // HDC pDC
  495. // long nStartingXPixel
  496. // long nStartingYPixel
  497. // double dRatio
  498. //
  499. // Return:
  500. // void
  501. //
  502. // Called by:
  503. // public DLL interface
  504. //
  505. ////////////////////////////////////////////////////////////////////////////////////
  506. void __declspec( dllexport ) DrawRationalCodabarBarcode(CString csMessage,double dHeight,double dNarrowBar,HDC pDC,long nStartingXPixel,long nStartingYPixel,double dRatio)
  507. {
  508. CRationalCodabar oBarcode;
  509. oBarcode.LoadData(csMessage,dNarrowBar,dHeight,pDC,nStartingXPixel,nStartingYPixel,dRatio);
  510. oBarcode.DrawBitmap();
  511. return;
  512. }
  513. ////////////////////////////////////////////////////////////////////////////////////
  514. //
  515. // Name:
  516. // GetRationalCodabarBarcodePixelWidth()
  517. //
  518. // Description:
  519. // Returns the length in pixels of the rational codabar barcode bitmap
  520. //
  521. // Arguments:
  522. // CString csMessage
  523. // double dNarrowBar
  524. // HDC pDC
  525. // double dRatio
  526. //
  527. // Return:
  528. // long - width in pixels of the rational codabar barcode bitmap
  529. //
  530. // Called by:
  531. // public DLL interface
  532. //
  533. ////////////////////////////////////////////////////////////////////////////////////
  534. long __declspec( dllexport ) GetRationalCodabarBarcodePixelWidth(CString csMessage, double dNarrowBar, HDC pDC, double dRatio)
  535. {
  536. long nPixelWidth;
  537. CRationalCodabar oBarcode;
  538. oBarcode.LoadData(csMessage,dNarrowBar,1.0,pDC,0,0,dRatio);
  539. nPixelWidth = oBarcode.GetBarcodePixelWidth();
  540. return nPixelWidth;
  541. }
  542. ////////////////////////////////////////////////////////////////////////////////////
  543. //
  544. // Name:
  545. // ErrorCheckRationalCodabarMessage()
  546. //
  547. // Description:
  548. // Error checks the input message to see if it is a legal rational codabar message
  549. //
  550. // Arguments:
  551. // CString csMessage
  552. //
  553. // Return:
  554. // BOOL - TRUE if a legal rational codabar message, FALSE if not a legal rational codabar message
  555. //
  556. // Called by:
  557. // public DLL interface
  558. //
  559. ////////////////////////////////////////////////////////////////////////////////////
  560. BOOL __declspec( dllexport ) ErrorCheckRationalCodabarMessage(CString csMessage)
  561. {
  562. return TRUE;
  563. }