Chapter 6: Programming Examples
47
RC: = S g l R e a d D a t a ( PROD_ABC_ID ,
RUN_DATE_ADR,
RUN_DATE_CNT ,
Addr ( RunDate ) ;
i f ( RC <> SGL_SUCCESS ) t h e n
b e g i n
{ no SG
−
L o c k f o u n d ! ! }
Memo1 . T e x t : =
’ S g l R e a d D a t a :
E r r o r !
’ +
c h a r ( $0D ) + c h a r ( $0A ) ;
end ;
{ r e a d d a t e f r o m s y s t e m , c o m p a r e w i t h RunDate
and d e c i d e
w h a t t o do }
end ;
6.4.3 Visual Basic
’ The
f i l e SGLW32 . BAS h a s t o b e i n c l u d e d
i n
t h e
p r o j e c t
’ t o e n s u r e
t h a t
a l l SG
−
L o c k f u n c t i o n s and c o n s t a n t s
’ a r e d e c l a r e d
! ! !
’ I n t h e c a s e a SG
−
L o c k u s e r
p r o t e c t s more t h a n 1
’ a p p l i c a t i o n / p r o d u c t , h e s h o u l d g i v e e a c h o f
i t a
’ u n i q u e
p r o d u c t ID . Then
i t s
v e r y e a s y t o
d i s t i n g u i s h
’ t h e SG
−
L o c k s
f o r e a c h p r o d u c t .
P u b l i c C o n s t PROD_ABC_ID As Long = 1
’ a d d r e s s e w h e r e d a t e
i s
s t o r e d
i n SG
−
L o c k
P u b l i c C o n s t RUN_DATE_ADR As Long = 10
’ d a t e
s t o r e d
a s y e a r / m o n t h / d a y ( 3 DWords )
P u b l i c C o n s t RUN_DATE_CNT As Long = 3
P r i v a t e Sub B u t t o n S e a r c h S G L o c k _ C l i c k ( )
Dim Rc As Long
’ R e t u r n C o d e
Dim RunDate ( 0 t o 2 ) As Long
’ d a t e
s t o r a g e
f o r c o m p a r e
’ Read d a t e t o r u n o f SG
−
L o c k w i t h p r o d u c t ABC
Rc = S g l R e a d D a t a ( PROD_ABC_ID , RUN_DATE_ADR,
RUN_DATE_CNT , RunDate ( )
)
S e l e c t Case Rc
Case SGL_SUCCESS
T e x t 1 . C a p t i o n = RunDate ( 0 ) & " / "&RunDate ( 1 ) & " / "&RunDate ( 2 )
Case SGL_DGL_NOT_FOUND
T e x t 1 . C a p t i o n = "SG
−
Lock n o t f o u n d ! "
E x i t Sub
Содержание SG-Lock
Страница 2: ......
Страница 22: ......
Страница 60: ......
Страница 62: ...56 Chapter 7 Technical Data Notes ...
Страница 63: ...Chapter 7 Technical Data 57 ...