Tuesday, March 25, 2008

VB

Option Explicit

'Ñîñòàâèë Ãåðàñêèí Ðîìàí Âèêòîðîâè÷

'Mail To: Grv@Dioton.ru

'ÖÒÎ OOO "Äèîòîí" Êðàñíîÿðñê 03.2005 ã.

'Âíèìàíèå íåêîòîðûå òèïû äàííûõ ïîäìåíåíû !!!

'èñêëþ÷èòåëüíî äëÿ óäîáñòâà.

'Îïèñàíèå ôóíêöèé îðèãèíàëüíîå.

'Íóæíû ðîäíûå òèïû ñì. CipherLab.H

''**********************************************************************

'' Äàííàÿ âåðñèÿ áóäåò ðàáîòàòü ñ ïðîøèâêàìè íà÷èíàÿ ñ âåðñèè ÀÍ31

''**********************************************************************

''**********************************************************************

'' Äëÿ îáìåíà äàííûìè òåðìèíàë äîëæåí íàõîäèòüñÿ â ãëàâíîì ìåíþ.

'' Ïåðåä èñïîëüçîâàíèåì ôóíêöèè ðåêîìåíäóåòñÿ ïðîâåðèòü ñîñòîÿíèå òåðìèíàëà:

'' ëèáî Ping, ëèáî GetCurrentState (ÑÎÌ-ïîðò ìîæåò áûòü îòêðûò, à âîò

'' òåðìèíàë ìîæåò íàõîäèòüñÿ íå â ñòàðòîâîì ìåíþ).

'' Ïðîâåðêà íà ñîñòîÿíèå ÑÎÌ-ïîðòà (îòêðûò/íå îòêðûò) ïðîèçâîäèòñÿ âíóòðè

'' ôóíêöèé, òàê ÷òî âûçîâ CheckComm íåîáÿçàòåëåí.

'' Ôóíêöèè Ping è GetCurrentState ïðàêòè÷åñêè îäèíàêîâûå. GetCurrentState ïëàíèðóåòñÿ

'' ïåðåäåëàòü äëÿ îòîáðàæåíèÿ, ãäå íàõîäèòñÿ òåðìèíàë (ñòàðòîâîå ìåíþ, çàãðóçêà, âûãðóçêà è ò.ä.).

'' Òàê ÷òî ïîëüçîâàòüñÿ ìîæíî îáåèìè, íî ÿ ñîâåòóþ Ping ò.ê. GetCurrentState ìîæåò èçìåíèòüñÿ.

'' Ïåðåäåëûâàòü ïðèäåòñÿ íå òîëüêî ôóíêöèþ, íî è ïðîøèâêó òåðìèíàëà...

'' Óêàçàòåëü íà ñòðîêîâóþ ïåðåìåííóþ ðåêîìåíäóåòñÿ èñïîëüçîâàòü òèïà char szData[256]; ïðåîáðàçîâàííûé ê(LPSTR)szData

'' Ïîëå íå ìîæåò ïðåâûøàòü 256 áàéò, ñòðîêà áàçû äàííûõ íå ìîæåò ïðåâûøàòü 1024 áàéò.

'' Áàç äàííûõ ìîæåò áûòü äî òðåõ: îò 1 äî 3. Ôàéëîâ äàííûõ äî 10: îò 0 äî 9. Ýòî çàâèñèò îò

'' çàäà÷è, ñãåíåðèðîâàííîé â Ãåíåðàòîðå Ïðèëîæåíèé

'' Åñëè êàêàÿ-ëèáî ôóíêöèÿ âîçâðàòèëà îøèáêó, ýòà ôóíêèÿ äàñò å¸ ïîäðîáíîå îïèñàíèå

'' Òàêæå Âû ìîæåòå íàéòè îïèñàíèå îøèáîê â ôàéëå Errors.txt

'' Ïàðàìåòðû:

'' óêàçàòåëü íà ñòðîêîâóþ ïåðåìåííóþ, êóäà áóäåò ïîìåùåíî îïèñàíèå îøèáêè èëè NULL, åñëè íóæåí òîëüêî íîìåð

'' Âîçâðàùàåìîå çíà÷àíèå:

'' íîìåð îøèáêè

Public Declare Function GetError Lib "stdCipherLab.dll" Alias "stdGetError" (szData As Any) As Long

'' Ôóíêöèÿ:Îòêðûòü ÑÎÌ ïîðò

'' Ïàðàìåòðû:

'' int nCommPort - öåëîå, íîìåð ÑÎÌ-ïîðòà, 1..16

'' int nCommSpeed - öåëîå, ñêîðîñòü ÑÎÌ - ïîðòà, 1..5

'' (1 - 115200, 2 - 57600, 3 - 38400, 4 - 19200, 5 - 9600)

'' BOOL bIsIrDA - ëîãè÷åñêîå, åñëè îáìåí áóäåò ïðîèçâîäèòüñÿ ÷åðåç Ir àäàïòåð

'' Âîçâðàùàåìîå çíà÷àíèå:

'' TRUE - åñëè ÑÎÌ ïîðò óñïåøíî îòêðûò

'' FALSE - èíà÷å.

Public Declare Function OpenComm Lib "stdCipherLab.dll" Alias "stdOpenComm" (ByVal nCommPort As Long, ByVal nCommSpeed As Long, ByVal bIsIrDA As Long) As Long

' Ôóíêöèÿ:ïðîâåðèòü ñîñòîÿíèå ÑÎÌ ïîðòà

' Ðåêîìåíäóåòñÿ âûçûâàòü äëÿ ïðîâåðêè ñîñòîÿíèÿ ÑÎÌ ïîðòà ïåðåä âûçîâîì ôóíêöèé.

' Ïàðàìåòðû:

' íåò

' Âîçâðàùàåìîå çíà÷àíèå:

' TRUE - åñëè ÑÎÌ ïîðò îòêðûò

' FALSE - èíà÷å.

Public Declare Function CheckComm Lib "stdCipherLab.dll" Alias "stdCheckComm" () As Long

' Ôóíêöèÿ:çàêðûòü ÑÎÌ ïîðò

' Ðåêîìåíäóåòñÿ âûçûâàòü ïåðåä âûõîäîì èç ïðèëîæåíèÿ.

' ÑÎÌ ïîðò ïðè âûõîäå âñå ðàâíî áóäåò çàêðûò, íî ëó÷øå íå ïîëàãàòüñÿ íà ñèñòåìó.

' Ïàðàìåòðû:

' íåò

' Âîçâðàùàåìîå çíà÷àíèå:

' íåò

Public Declare Sub CloseComm Lib "stdCipherLab.dll" Alias "stdCloseComm" ()

' Ôóíêöèÿ:ïðîâåðèòü íàëè÷èå òåðìèíàëà íà äàííîì ÑÎÌ ïîðòó.

' Òåðìèíàë äîëæåí íàõîäèòüñÿ â ãëàâíîì ìåíþ èëè ñîñòîÿíèè çàãðóçêè / âûíãðóçêè

' Ïàðàìåòðû:

' íåò

' Âîçâðàùàåìîå çíà÷àíèå:

' TRUE - åñëè òåðìèíàë îòîçâàëñÿ

' FALSE - èíà÷å.

Public Declare Function Ping Lib "stdCipherLab.dll" Alias "stdPing" () As Long

' Ôóíêöèÿ:ïîëó÷èòü êîë-âî ñâîáîäíîé ïàìÿòè

' Ïàðàìåòðû:

' íåò

' Âîçâðàùàåìîå çíà÷àíèå:

' äëèííîå öåëîå, êîë-âî ñâîáîäíîé ïàìÿòè â áàéòàõ

' 0 èëè íèæå ïðè âîçíèêíîâåíèè îøèáêè

Public Declare Function GetFreeMemory Lib "stdCipherLab.dll" Alias "stdGetFreeMemory" () As Long

' Ôóíêöèÿ:ïîëó÷èòü ñåðèéíûé íîìåð òåðìèíàëà

' Òåðìèíàë äîëæåí íàõîäèòüñÿ â ãëàâíîì ìåíþ èëè ñîñòîÿíèè çàãðóçêè / âûíãðóçêè

' Ïàðàìåòðû:

' óêàçàòåëü íà ñòðîêîâóþ ïåðåìåííóþ, êóäà áóäåò ïîìåùåí íîìåð òåðìèíàëà

' Âîçâðàùàåìîå çíà÷àíèå:

' TRUE - åñëè íîìåð ïåðåäàí

' FALSE - èíà÷å.

Public Declare Function GetSerialNumber Lib "stdCipherLab.dll" Alias "stdGetSerialNumber" (szData$) As Long

' Ôóíêöèÿ:ïîëó÷èòü òåêóùåå ñèñòåìíîå âðåìÿ òåðìèíàëà

' Òåðìèíàë äîëæåí íàõîäèòüñÿ â ãëàâíîì ìåíþ èëè ñîñòîÿíèè çàãðóçêè / âûíãðóçêè

' Ïàðàìåòðû:

' óêàçàòåëü íà ñòðîêîâóþ ïåðåìåííóþ, êóäà áóäåò ïîìåùåíî âðåìÿ òåðìèíàëà â ôîðìàòå ÃÃÃÃÌÌÄÄ××ÌÌÑÑ

' Âîçâðàùàåìîå çíà÷àíèå:

' TRUE - åñëè âðåìÿ ïîëó÷åíî

' FALSE - èíà÷å.

Public Declare Function GetTime Lib "stdCipherLab.dll" Alias "stdGetTime" (szData$) As Long

' Ôóíêöèÿ:îáíîâèòü âðåìÿ òåðìèíàëà

' Â òåðìèíàë áóäåò ïåðåäàííî ñèñòåìíîå âðåìÿ

' Ïàðàìåòðû:

' íåò

' Âîçâðàùàåìîå çíà÷àíèå:

' TRUE - åñëè âðåìÿ îáíîâëåííî

' FALSE - èíà÷å.

Public Declare Function UpdateTime Lib "stdCipherLab.dll" Alias "stdUpdateTime" () As Long

' Ôóíêöèÿ:ïðîâåðÿåò - íàõîäèòñÿ ëè òåðìèíàë â ñòàðòîâîì ìåíþ (ãîòîâíîñòü ê îáìåíó äàííûìè)

' Ïàðàìåòðû:

' íåò

' Âîçâðàùàåìîå çíà÷àíèå:

' TRUE - åñëè òåðìèíàë ãîòîâ ê ðàáîòå (íàõîäèòñÿ â ñòàðòîâîì ìåíþ)

' FALSE - èíà÷å.

Public Declare Function GetCurrentState Lib "stdCipherLab.dll" Alias "stdGetCurrentState" () As Long

'' Ôóíêöèÿ:ïîëó÷èòü êîë-âî çàïèñåé â äîêóìåíòå íîìåð (0-9)

'' Ïàðàìåòðû:

'' íîìåð äîêóìåíòà (0-9)

'' Âîçâðàùàåìîå çíà÷àíèå:

'' äëèííîå öåëîå, êîë-âî çàïèñåé

'' -1 ïðè âîçíèêíîâåíèè îøèáêè

Public Declare Function GetDataCount Lib "stdCipherLab.dll" Alias "stdGetDataCount" (ByVal nDoc&) As Long

'' Ôóíêöèÿ:ïîëó÷èòü êîë-âî çàïèñåé â Áàçå Äàííûõ íîìåð (1-3)

'' Ïàðàìåòðû:

'' íîìåð Áàçû äàííûõ (1-3)

'' Âîçâðàùàåìîå çíà÷àíèå:

'' äëèííîå öåëîå, êîë-âî çàïèñåé

'' -1 ïðè âîçíèêíîâåíèè îøèáêè

Public Declare Function GetRecordsCount Lib "stdCipherLab.dll" Alias "stdGetRecordsCount" (ByVal nBase&) As Long

'' Ôóíêöèÿ:î÷èñòèòü ñîäåðæèìîå äîêóìåíòà íîìåð (0-9)

'' Ïàðàìåòðû:

'' íîìåð äîêóìåíòà (0-9)

'' Âîçâðàùàåìîå çíà÷àíèå:

'' TRUE - åñëè óñïåøíî î÷èùåííî

'' FALSE - èíà÷å.

Public Declare Function ClearDoc Lib "stdCipherLab.dll" Alias "stdClearDoc" (ByVal nDoc&) As Long

'' Ôóíêöèÿ:î÷èñòèòü ñîäåðæèìîå Áàçû Äàííûõ íîìåð (1-3)

'' Ïàðàìåòðû:

'' íîìåð Áàçû äàííûõ (1-3)

'' Âîçâðàùàåìîå çíà÷àíèå:

'' TRUE - åñëè óñïåøíî î÷èùåííî

'' FALSE - èíà÷å.

Public Declare Function ClearDB Lib "stdCipherLab.dll" Alias "stdClearDB" (ByVal nBase&) As Long

'' Ôóíêöèÿ:ïîëó÷èòü î÷åðåäíóþ çàïèñü èç äîêóìåíòà íîìåð (0-9)

'' Åñëè òåðìèíàë íàõîäèòüñÿ â ãëàâíîì ìåíþ, îí áóäåò ïåðåâåäåí â ñîñòîÿíèå âûãðóçêè

'' Ïàðàìåòðû:

'' íîìåð äîêóìåíòà (0-9)

'' óêàçàòåëè íà ñòðîêîâûå ïåðåìåííûå, êóäà áóäóò ïîìåùåíû ïîëÿ äîêóìåíòà

'' Âîçâðàùàåìîå çíà÷àíèå:

'' 1 - óñïåøíî!

'' 0 çàïèñåé íåò, îáìåí çàâåðøåí

'' -1 ïðè âîçíèêíîâåíèè îøèáêè

'Public Declare Function ReadData Lib "stdCipherLab.dll" Alias "stdReadData" (ByVal nDoc&, szData1$, szData2$, szData3$, szData4$, szData5$, szData6$, szData7$, szData8$) As Long

Public Declare Function ReadData Lib "stdCipherLab.dll" Alias "stdReadData" (ByVal nDoc&, szData1 As Any, szData2 As Any, szData3 As Any, szData4 As Any, szData5 As Any, szData6 As Any, szData7 As Any, szData8 As Any) As Long

'Public Declare Function ReadData Lib "stdCipherLab.dll" Alias "stdReadData" (ByVal nDoc&, szData1 As FField, szData2 As FField, szData3 As FField, szData4 As FField, szData5 As FField, szData6 As FField, szData7 As FField, szData8 As FField) As Long

'' Ôóíêöèÿ:ïîëó÷èòü î÷åðåäíóþ çàïèñü èç äîêóìåíòà (0) èëè Áàçû Äàííûõ íîìåð (1-3)

'' Åñëè òåðìèíàë íàõîäèòüñÿ â ãëàâíîì ìåíþ, îí áóäåò ïåðåâåäåí â ñîñòîÿíèå âûãðóçêè

'' Ïàðàìåòðû:

'' íîìåð Áàçû äàííûõ (1-3)

'' óêàçàòåëè íà ñòðîêîâûå ïåðåìåííûå, êóäà áóäóò ïîìåùåíû ïîëÿ áàçû äàííûõ

'' Âîçâðàùàåìîå çíà÷àíèå:

'' 1 - óñïåøíî!

'' 0 çàïèñåé íåò, îáìåí çàâåðøåí

'' -1 èëè íèæå ïðè âîçíèêíîâåíèè îøèáêè

'Public Declare Function ReadRecord Lib "stdCipherLab.dll" Alias "stdReadRecord" (ByVal nBase&, szData1$, szData2$, szData3$, szData4$, szData5$, szData6$, szData7$, szData8$) As Long

Public Declare Function ReadRecord Lib "stdCipherLab.dll" Alias "stdReadRecord" (ByVal nBase&, szData1 As Any, szData2 As Any, szData3 As Any, szData4 As Any, szData5 As Any, szData6 As Any, szData7 As Any, szData8 As Any) As Long

'Public Declare Function ReadRecord Lib "stdCipherLab.dll" Alias "stdReadRecord" (ByVal nBase&, szData1 As FField, szData2 As FField, szData3 As FField, szData4 As FField, szData5 As FField, szData6 As FField, szData7 As FField, szData8 As FField) As Long

'' Ôóíêöèÿ:çàãðóçèòü çàïèñü â Áàçó Äàííûõ íîìåð (1-3)

'' Åñëè òåðìèíàë íàõîäèòüñÿ â ãëàâíîì ìåíþ, îí áóäåò ïåðåâåäåí â ñîñòîÿíèå çàãðóçêè äûííûõ

'' Ïàðàìåòðû:

'' íîìåð Áàçû äàííûõ (1-3)

'' óêàçàòåëü íà çàãðóæàåìûå ïîëÿ áàçû äàííûõ

'' Âîçâðàùàåìîå çíà÷àíèå:

'' TRUE - åñëè çàïèñü óñïåøíî çàãðóæåíà

'' FALSE - èíà÷å.

Public Declare Function PutRecord Lib "stdCipherLab.dll" Alias "stdPutRecord" (ByVal nBase&, szData1 As Any, szData2 As Any, szData3 As Any, szData4 As Any, szData5 As Any, szData6 As Any, szData7 As Any, szData8 As Any) As Long

'' Äëÿ çàâåðøåíèÿ çàãðóçêè è ñòàðòà èíäåêñèðîâàíèÿ èñïîëüçóéòå äàííóþ ôóíêöèþ

'' Ïàðàìåòðû:

'' íåò

'' Âîçâðàùàåìîå çíà÷àíèå:

'' TRUE - åñëè çàãðóçêà óñïåøíî çàâåðøåíà

'' FALSE - èíà÷å.

Public Declare Function Finish Lib "stdCipherLab.dll" Alias "stdFinish" () As Long

'' Ïîêàçûâàåò ñîîáùåíèå î õîäå âûïîëíåíèÿ ïåðåäà÷è äàííûõ

'' Ïàðàìåòðû:

'' int nAction - 1 Âûñâå÷èâàåòñÿ íàäïèñü "Îñòàëîñü ïîëó÷èòü: %d çàïèñåé"

'' - 0 Âûñâå÷èâàåòñÿ íàäïèñü "Îñòàëîñü ïåðåäàòü: %d çàïèñåé"

'' int nCount - ÷èñëî, êîòîðîå áóäåò ïîäñòàâëÿòüñÿ â íàäïèñå.

'' Âîçâðàùàåìîå çíà÷àíèå:

'' íåò

Public Declare Sub ShowProgress Lib "stdCipherLab.dll" Alias "stdShowProgress" (ByVal nAction As Long, ByVal nCount As Long)

'' Èçìåíÿåò çíà÷åíèå ðàçäåëèòåëåé â ïîëÿõ áàçû è äîêóìåíòà

'' Ïàðàìåòðû:

'' char Base - ðàçäåëèòåëü äëÿ ïîëåé áàçû, ïî óìîë÷àíèå êîä 9 (òàáóëÿöèÿ)

'' char Doc - ðàçäåëèòåëü äëÿ ïîëåé áàçû, ïî óìîë÷àíèå êîä 9 (òàáóëÿöèÿ)

'' Âîçâðàùàåìîå çíà÷àíèå:

'' íåò

Public Declare Sub Delimiter Lib "stdCipherLab.dll" Alias "stdDelimiter" (ByVal Base As Byte, ByVal Doc As Byte)

'' Çàãðóæàåò äàííûå â áàçó èç ôàéëà

'' Ïàðàìåòðû:

'' nBase - íîìåð Áàçû äàííûõ (1-3)

'' nPath - óêàçàòåëü íà ñòðîêîâóþ ïåðåìåííóþ, ãäå ïåðåäàåòñÿ ïóòü ê ôàéëó

'' Âîçâðàùàåìîå çíà÷àíèå:

'' TRUE - åñëè îáìåí óñïåøíî çàâåðøåí

'' FALSE - èíà÷å.

Public Declare Function FileToBase Lib "stdCipherLab.dll" Alias "stdFileToBase" (ByVal nBase As Long, ByVal nPath As String) As Long

'' Âûãðóæàåò èç òåðìèíàëà äîêóìåíò è çàïèñûâàåò â ôàéë

'' Ïàðàìåòðû:

'' nDoc - íîìåð äîêóìåíòà (0-9)

'' nPath - óêàçàòåëü íà ñòðîêîâóþ ïåðåìåííóþ, ãäå ïåðåäàåòñÿ ïóòü ê ôàéëó

'' Âîçâðàùàåìîå çíà÷àíèå:

'' TRUE - åñëè îáìåí óñïåøíî çàâåðøåí

'' FALSE - èíà÷å.

Public Declare Function DocToFile Lib "stdCipherLab.dll" Alias "stdDocToFile" (ByVal nDoc As Long, ByVal nPath As String) As Long

'' Âûãðóæàåò èç òåðìèíàëà áàçó è çàïèñûâàåò â ôàéë

'' Ïàðàìåòðû:

'' nBase - íîìåð Áàçû äàííûõ (1-3)

'' nPath - óêàçàòåëü íà ñòðîêîâóþ ïåðåìåííóþ, ãäå ïåðåäàåòñÿ ïóòü ê ôàéëó

'' Âîçâðàùàåìîå çíà÷àíèå:

'' TRUE - åñëè îáìåí óñïåøíî çàâåðøåí

'' FALSE - èíà÷å.

Public Declare Function BaseToFile Lib "stdCipherLab.dll" Alias "stdBaseToFile" (ByVal nBase As Long, ByVal nPath As String) As Long

'' Ôóíêöèÿ:îáíîâèòü çàïèñü â Áàçå Äàííûõ íîìåð (1-3)

'' Åñëè òåðìèíàë íàõîäèòüñÿ â ãëàâíîì ìåíþ, îí áóäåò ïåðåâåäåí â ñîñòîÿíèå çàãðóçêè äûííûõ

'' Ïàðàìåòðû:

'' íîìåð Áàçû äàííûõ (1-3)

'' óêàçàòåëü íà çàãðóæàåìûå ïîëÿ áàçû äàííûõ

'' Âîçâðàùàåìîå çíà÷àíèå:

'' TRUE - åñëè çàïèñü óñïåøíî çàãðóæåíà

'' FALSE - èíà÷å.

Public Declare Function UpdateRecord Lib "stdCipherLab.dll" Alias "stdUpdateRecord" (ByVal nBase&, szData1 As Any, szData2 As Any, szData3 As Any, szData4 As Any, szData5 As Any, szData6 As Any, szData7 As Any, szData8 As Any) As Long

Public Declare Function GetDelay Lib "stdCipherLab.dll" Alias "stdGetDelay" () As Long

Public Declare Function SetDelay Lib "stdCipherLab.dll" Alias "stdSetDelay" (ByVal Delay As Long) As Long

Public Declare Function ClearDBField Lib "stdCipherLab.dll" Alias "stdClearDBField" (ByVal Base As Long, ByVal Field As Long) As Long

' Äóáëèðóåò GetError

Public Function GetErrorDescription(ByVal RetCode As Long) As String

Dim sMsg As String

Select Case RetCode

Case 0

sMsg = "Îïåðàöèÿ áûëà çàâåðøåíà óñïåøíî!"

Case 1

sMsg = "COM ïîðò íå èíèöèàëèçèðîâàí!"

Case 2

sMsg = "Íåâîçìîæíî îòêðûòü COM ïîðò!"

Case 3

sMsg = "Íåâîçìîæíî íàñòðîèòü COM ïîðò!"

Case 4

sMsg = "Íåâîçìîæíî íàñòðîèòü IR àäàïòåð!"

Case 5

sMsg = "Îøèáêà ÑÎÌ ïîðòà!"

Case 6

sMsg = "Ñëèøêîì êîðîòêèå äàííûå äëÿ ïåðåäà÷è!"

Case 7

sMsg = "Ñëèøêîì äëèííûå äàííûå äëÿ ïåðåäà÷è!"

Case 8

sMsg = "Òàéì - àóò! Äàííûå íå ïåðåäàíû!"

Case 9

sMsg = "Îøèáêà ïåðåäà÷è äàííûõ! Äàííûå íå ïåðåäàíû!"

Case 10

sMsg = "Ôîðìàò Áàçû Äàííûõ íå îïðåäåëåí!"

Case 11

sMsg = "Îòâåò òåðìèíàëà ACK íå ñîîòâåòñòâóåò îæèäàåìîìó!"

Case 12

sMsg = "Îòâåò òåðìèíàëà NAK íå ñîîòâåòñòâóåò îæèäàåìîìó!"

Case 13

sMsg = "Îòâåò òåðìèíàëà OVER íå ñîîòâåòñòâóåò îæèäàåìîìó!"

Case 14

sMsg = "Îòâåò òåðìèíàëà OK íå ñîîòâåòñòâóåò îæèäàåìîìó!"

Case 15

sMsg = "Îòâåò òåðìèíàëà ERR íå ñîîòâåòñòâóåò îæèäàåìîìó!"

Case 16

sMsg = "Íåèçâåñòíûé îòâåò òåðìèíàëà!"

Case 17

sMsg = "Ñëèøêîì äëèííûå äàííûå äëÿ ïðèåìà!"

Case 18

sMsg = "Íåâîçìîæíî ïðåðâåñòè òåðìèíàë â ðåæèì çàãðóçêè!"

Case 19

sMsg = "Ïåðåïîëíåíèå ïàìÿòè!Çàâåðøåíî!"

Case 20

sMsg = "Íåò äàííûõ äëÿ ïåðåäà÷è!"

Case 21

sMsg = "Íåâåðíûå íàñòðîéêè ïîðòà!"

Case 22

sMsg = "Íåâåðíûé äèàïàçîí áàçû (1..3)!"

Case 23

sMsg = "Íåâåðíûé äèàïàçîí äîêóìåíòà (0..9)!"

Case 24

sMsg = "Ïåðåäàí ïàðàìåòð íåâåðíîãî òèïà!"

Case 25

sMsg = "Îøèáêà îáíîâëåíèÿ âðåìåíè!"

Case 26

sMsg = "Áàçà íå îïðåäåëåíà. Ñîçäàéòå áàçó äàííûõ â çàäà÷å!"

Case 27

sMsg = "Áàçà íå ðàçðåøåíà äëÿ âûãðóçêè. Èçìåíèòå íàñòðîêè â çàäà÷å!"

Case 28

sMsg = "Ôàéë îáìåíà íå íàéäåí!"

Case 29

sMsg = "Îøèáêà ÷òåíèÿ ôàéëà!"

Case 30

sMsg = "Íåâîçìîæíî çàïèñàòü â ôàéë!"

Case 31

sMsg = "Ôàéë çàùèùåí îò çàïèñè!"

Case 32

sMsg = "Óêàçàííûé íåâåðíûé ïóòü ê ôàéëó!"

Case 33

sMsg = "Ïîëå ÁÄ óêàçàíî íåâåðíî!"

Case 34

sMsg = "Íàðóøåíà ïîñëåäîâàòåëüíîñòü çàïèñåé! Ñîîáùèòå ïîæàëóéñòà ðàçðàáîò÷èêó!"

End Select

GetErrorDescription = sMsg

End Function

Public Function GetStopError() As Boolean

Dim sMsg As String, ErrCode As Long

sMsg = String(256, " ")

ErrCode = GetError(ByVal sMsg)

sMsg = Trim(sMsg)

MsgBox Prompt:=sMsg & " Êîä: " & CStr(ErrCode), buttons:=vbCritical, Title:="CipherLab.Dll Error !"

' Îøèáêè ïî êîòîðûì ñòîèò è âûéòè èç öèêëà

Select Case ErrCode

Case 8, 9, 27, 13, 15

GetStopError = True

Case 19, 34

If Ping <> 1 Then Finish ' Òóò íóæíî ïîäóìàòü

GetStopError = True

End Select

End Function

Function GetVbError() As String 'Óïàêîâàë GetError

Dim ErrNum As Long, strErr As String

strErr = String(256, " ")

ErrNum = GetError(ByVal strErr)

strErr = RTrim(strErr)

GetVbError = "Êîä îøèáêè: " & CStr(ErrNum) & " Îïèñàíèå: " & strErr

End Function

' ×èñòî äëÿ ñåáÿ, âàì íè êàêîé ïîëüçû

Public Function GetMessageOK(ByVal mCode As Long) As String

Dim sMsg As String

Select Case mCode

Case 0

sMsg = Empty

Case 1

sMsg = "Îïåðàöèÿ çàâåðøåíà óñïåøíî"

Case 2

sMsg = "Êîì Ïîðò îòêðûò óñïåøíî"

Case 3

sMsg = "Òåðìèíàë â ãëàâíîì Ìåíþ"

Case 4

sMsg = "Ïîðò îòêðûò"

Case 5

sMsg = "Íîâîå Âðåìÿ è Äàòà - óñòàíîâëåíû"

End Select

GetMessageOK = sMsg

End Function