Centar za edukaciju-BiH



#1 04.04.2014 00:30
Gjoreski Van mreze
Administrator
Registrovan od:02.02.2009
Postovi:1,854


Predmet:Clasa Vo Access
IMAM EDNA CLASA KOJAVO VB6 RABOTI DOBRO ,SEGA MI TREBA OVAA CLASA DA JA UPOTREBAM VO EDNA ACCESS APLIKACIJA NO NESTO NE ODI .
DALI OVAA CLASA MOZE VOOPSTO DA SE KORISTI VO ACCESS?
PreuzmiIzvorni kôd (Visual Basic):
  1. Option Explicit
  2.  
  3. Dim WithEvents mComm As MSComm
  4. Dim m_PortOpen As Boolean
  5. Dim m_Settings As String
  6. Dim m_CommPort As Integer
  7. Dim m_DTREnable As Boolean
  8. Dim m_Handshaking As FlowControl
  9. Dim m_InBufferSize As Integer
  10. Dim m_InputLen As Integer
  11. Dim m_InputMode As Mode
  12. Dim m_OutBufferSize As Integer
  13. Dim m_RTSEnable As Boolean
  14. Dim m_CommEvent As Integer
  15.  
  16. Event OnComm()
  17.  
  18. Public Enum FlowControl
  19.     None = 0
  20.     XonXoff = 1
  21.     CTSRTS = 2
  22.     XonXoffCTSRTS = 3
  23. End Enum
  24.  
  25. Public Enum Mode
  26.     Text = 0
  27.     Binary = 1
  28. End Enum
  29.  
  30. Public Sub Output(Dat As Variant)
  31.   mComm.Output = Dat
  32. End Sub
  33.  
  34. Public Property Get InBufferCount() As Integer
  35.   InBufferCount = mComm.InBufferCount
  36. End Property
  37.  
  38. Public Property Get InputData() As Variant
  39.   InputData = mComm.Input
  40. End Property
  41.  
  42. Public Property Get OutBufferCount() As Integer
  43.     OutBufferCount = mComm.OutBufferCount
  44. End Property
  45.  
  46. Public Property Let PortOpen(ByVal NewValue As Boolean)
  47.     If m_PortOpen = False And NewValue = True Then
  48.         With mComm
  49.             .ParityReplace = ""
  50.             .Settings = m_Settings
  51.             .CommPort = m_CommPort
  52.             .DTREnable = m_DTREnable
  53.             .Handshaking = m_Handshaking
  54.             .InBufferSize = m_InBufferSize
  55.             .InputLen = m_InputLen
  56.             .InputMode = m_InputMode
  57.             .OutBufferSize = m_OutBufferSize
  58.             .RTSEnable = m_RTSEnable
  59.             .PortOpen = True
  60.         End With
  61.         m_PortOpen = True
  62.     ElseIf NewValue = False Then
  63.         mComm.PortOpen = False
  64.         m_PortOpen = False
  65.     End If
  66. End Property
  67.  
  68. Public Property Get PortOpen() As Boolean
  69.     PortOpen = m_PortOpen
  70. End Property
  71.  
  72. Private Sub Class_Initialize()
  73.     m_Settings = "9600, N, 8, 1"
  74.     m_CommPort = 1
  75.     m_InBufferSize = 1024
  76.     m_OutBufferSize = 1024
  77.     Set mComm = CreateObject("MSCOMMLIB.MSCOMM")
  78. End Sub
  79.  
  80. Public Property Get CommPort() As Integer
  81.     CommPort = m_CommPort
  82. End Property
  83.  
  84. Public Property Let CommPort(ByVal NewValue As Integer)
  85.     m_CommPort = NewValue
  86.     If m_PortOpen = True Then mComm.CommPort = NewValue
  87. End Property
  88.  
  89. Public Property Get DTREnable() As Boolean
  90.     DTREnable = m_DTREnable
  91. End Property
  92.  
  93. Public Property Let DTREnable(ByVal NewValue As Boolean)
  94.     m_DTREnable = NewValue
  95.     If m_PortOpen = True Then mComm.DTREnable = NewValue
  96. End Property
  97.  
  98. Public Property Get Handshaking() As FlowControl
  99.     Handshaking = m_Handshaking
  100. End Property
  101.  
  102. Public Property Let Handshaking(ByVal NewValue As FlowControl)
  103.     m_Handshaking = NewValue
  104.     If m_PortOpen = True Then mComm.Handshaking = NewValue
  105. End Property
  106.  
  107. Public Property Get InBufferSize() As Integer
  108.     InBufferSize = m_InBufferSize
  109. End Property
  110.  
  111. Public Property Let InBufferSize(ByVal NewValue As Integer)
  112.     m_InBufferSize = NewValue
  113.     If m_PortOpen = True Then mComm.InBufferSize = NewValue
  114. End Property
  115.  
  116. Public Property Get InputLen() As Integer
  117.     InputLen = m_InputLen
  118. End Property
  119.  
  120. Public Property Let InputLen(ByVal NewValue As Integer)
  121.     m_InputLen = NewValue
  122.     If m_PortOpen = True Then mComm.InputLen = NewValue
  123. End Property
  124.  
  125. Public Property Get InputMode() As Mode
  126.     InputMode = m_InputMode
  127. End Property
  128.  
  129. Public Property Let InputMode(ByVal NewValue As Mode)
  130.     m_InputMode = NewValue
  131.     If m_PortOpen = True Then mComm.InputMode = NewValue
  132. End Property
  133.  
  134. Public Property Get OutBufferSize() As Integer
  135.     OutBufferSize = m_OutBufferSize
  136. End Property
  137.  
  138. Public Property Let OutBufferSize(ByVal NewValue As Integer)
  139.     m_OutBufferSize = NewValue
  140.     If m_PortOpen = True Then mComm.OutBufferSize = NewValue
  141. End Property
  142.  
  143. Public Property Get RTSEnable() As Boolean
  144.     RTSEnable = m_RTSEnable
  145. End Property
  146.  
  147. Public Property Let RTSEnable(ByVal NewValue As Boolean)
  148.     m_RTSEnable = NewValue
  149.     If m_PortOpen = True Then mComm.RTSEnable = NewValue
  150. End Property
  151.  
  152. Public Property Get CDHolding() As Boolean
  153.     If m_PortOpen = True Then CDHolding = mComm.CDHolding
  154. End Property
  155.  
  156. Public Property Get CTSHolding() As Boolean
  157.     If m_PortOpen = True Then CTSHolding = mComm.CTSHolding
  158. End Property
  159.  
  160. Public Property Get DSRHolding() As Boolean
  161.     If m_PortOpen = True Then DSRHolding = mComm.DSRHolding
  162. End Property
  163.  
  164. Private Sub Class_Terminate()
  165.     Set mComm = Nothing
  166. End Sub
  167.  
  168. Public Property Get CommEvent() As Integer
  169.     CommEvent = m_CommEvent
  170. End Property
  171.  
  172. Private Sub mComm_OnComm()
  173.     m_CommEvent = mComm.CommEvent
  174.     RaiseEvent OnComm
  175.     m_CommEvent = 0
  176. End Sub
  177.  
  178. Public Property Get RThreshold() As Integer
  179.     RThreshold = mComm.RThreshold
  180. End Property
  181.  
  182. Public Property Let RThreshold(ByVal NewValue As Integer)
  183.     mComm.RThreshold = NewValue
  184. End Property
↑  ↓

#2 04.04.2014 07:49
zxz Van mreze
Administrator
Registrovan od:03.02.2009
Postovi:10,644


Predmet:Re: Clasa Vo Access
Enum ne podrzava accessov vb-a, bar ne ove nize verzije 2007 i dalje nisam probao.
Moze se to prepraviti pa umjesto enum u tvom slucaju konstnte koliko vidim.

Vidim da se radi o com portu pa bi mozda dobro bilo da opises sta zelis napraviti.
Pretpostavljam pokupiti neke podatke sa com porta na koji je prikopcan neki uredjaj.
Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.
↑  ↓

#3 04.04.2014 13:31
Gjoreski Van mreze
Administrator
Registrovan od:02.02.2009
Postovi:1,854


Predmet:Re: Clasa Vo Access
Tocno se rabotit za mscomm32.ocx controlata.
Imam programa za trgovija na malo odnosno Kasa , priem na roba i uste nekolku vakvi formi.
Na site ovie formi imam po edna mscomm controla koja ja koristam za barcod citaci koi se povrzuvaat na COM. Ovaa kontrola super funkcionira i sum nemal nikakvi problemi no sega mi se javi eden problem na Win8 64 bit , odnosno problemot e vo toa sto Accesot ne ja prepoznava controlata ,Controlata e registrirana i funkcionira no ne so access. Veke nekolku vreme se obiduvam da go resam ova no ne odi nekako mi e zkocena rabotava .Sakam da probam na ovaj nacin dali ke se resi problemot ili da baram druga kontrola.
↑  ↓

#4 04.04.2014 14:00
zxz Van mreze
Administrator
Registrovan od:03.02.2009
Postovi:10,644


Predmet:Re: Clasa Vo Access
Uf nemam win 8 pa nemogu isprobati ali sigurno postoji druga kontrola i mozda 64-bitna.
Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.
↑  ↓

#5 04.04.2014 14:52
Gjoreski Van mreze
Administrator
Registrovan od:02.02.2009
Postovi:1,854


Predmet:Re: Clasa Vo Access
Moze ovaa Clasa da se preapravi i da probam da vidam sto ke bide , ne bi sakal da ja menuvam controlat
bidejki ke mi se otvori mnogu rabota a nemam vreme tolku da gubam ,ne se isplati.
↑  ↓

#6 04.04.2014 17:12
zxz Van mreze
Administrator
Registrovan od:03.02.2009
Postovi:10,644


Predmet:Re: Clasa Vo Access
PreuzmiIzvorni kôd (Visual Basic):
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Dim mComm As MSComm
  5. Dim m_PortOpen As Boolean
  6. Dim m_Settings As String
  7. Dim m_CommPort As Integer
  8. Dim m_DTREnable As Boolean
  9. Dim m_Handshaking As FlowControl
  10. Dim m_InBufferSize As Integer
  11. Dim m_InputLen As Integer
  12. Dim m_InputMode As Mode
  13. Dim m_OutBufferSize As Integer
  14. Dim m_RTSEnable As Boolean
  15. Dim m_CommEvent As Integer
  16.  
  17.  
  18.     Const None = 0
  19.     Const XonXoff = 1
  20.     Const CTSRTS = 2
  21.     Const XonXoffCTSRTS = 3
  22.  
  23.  
  24.  
  25.    Const Text = 0
  26.    Const Binary = 1
  27.  
  28.  
  29. Public Sub Output(Dat As Variant)
  30.   mComm.Output = Dat
  31. End Sub
  32.  
  33. Public Property Get InBufferCount() As Integer
  34.   InBufferCount = mComm.InBufferCount
  35. End Property
  36.  
  37. Public Property Get InputData() As Variant
  38.   InputData = mComm.Input
  39. End Property
  40.  
  41. Public Property Get OutBufferCount() As Integer
  42.     OutBufferCount = mComm.OutBufferCount
  43. End Property
  44.  
  45. Public Property Let PortOpen(ByVal NewValue As Boolean)
  46.     If m_PortOpen = False And NewValue = True Then
  47.         With mComm
  48.             .ParityReplace = ""
  49.             .Settings = m_Settings
  50.             .CommPort = m_CommPort
  51.             .DTREnable = m_DTREnable
  52.             .Handshaking = m_Handshaking
  53.             .InBufferSize = m_InBufferSize
  54.             .InputLen = m_InputLen
  55.             .InputMode = m_InputMode
  56.             .OutBufferSize = m_OutBufferSize
  57.             .RTSEnable = m_RTSEnable
  58.             .PortOpen = True
  59.         End With
  60.         m_PortOpen = True
  61.     ElseIf NewValue = False Then
  62.         mComm.PortOpen = False
  63.         m_PortOpen = False
  64.     End If
  65. End Property
  66.  
  67. Public Property Get PortOpen() As Boolean
  68.     PortOpen = m_PortOpen
  69. End Property
  70.  
  71. Private Sub Class_Initialize()
  72.     m_Settings = "9600, N, 8, 1"
  73.     m_CommPort = 1
  74.     m_InBufferSize = 1024
  75.     m_OutBufferSize = 1024
  76.     Set mComm = CreateObject("MSCOMMLIB.MSCOMM")
  77. End Sub
  78.  
  79. Public Property Get CommPort() As Integer
  80.     CommPort = m_CommPort
  81. End Property
  82.  
  83. Public Property Let CommPort(ByVal NewValue As Integer)
  84.     m_CommPort = NewValue
  85.     If m_PortOpen = True Then mComm.CommPort = NewValue
  86. End Property
  87.  
  88. Public Property Get DTREnable() As Boolean
  89.     DTREnable = m_DTREnable
  90. End Property
  91.  
  92. Public Property Let DTREnable(ByVal NewValue As Boolean)
  93.     m_DTREnable = NewValue
  94.     If m_PortOpen = True Then mComm.DTREnable = NewValue
  95. End Property
  96.  
  97. Public Property Get Handshaking() As FlowControl
  98.     Handshaking = m_Handshaking
  99. End Property
  100.  
  101. Public Property Let Handshaking(ByVal NewValue As FlowControl)
  102.     m_Handshaking = NewValue
  103.     If m_PortOpen = True Then mComm.Handshaking = NewValue
  104. End Property
  105.  
  106. Public Property Get InBufferSize() As Integer
  107.     InBufferSize = m_InBufferSize
  108. End Property
  109.  
  110. Public Property Let InBufferSize(ByVal NewValue As Integer)
  111.     m_InBufferSize = NewValue
  112.     If m_PortOpen = True Then mComm.InBufferSize = NewValue
  113. End Property
  114.  
  115. Public Property Get InputLen() As Integer
  116.     InputLen = m_InputLen
  117. End Property
  118.  
  119. Public Property Let InputLen(ByVal NewValue As Integer)
  120.     m_InputLen = NewValue
  121.     If m_PortOpen = True Then mComm.InputLen = NewValue
  122. End Property
  123.  
  124. Public Property Get InputMode() As Mode
  125.     InputMode = m_InputMode
  126. End Property
  127.  
  128. Public Property Let InputMode(ByVal NewValue As Mode)
  129.     m_InputMode = NewValue
  130.     If m_PortOpen = True Then mComm.InputMode = NewValue
  131. End Property
  132.  
  133. Public Property Get OutBufferSize() As Integer
  134.     OutBufferSize = m_OutBufferSize
  135. End Property
  136.  
  137. Public Property Let OutBufferSize(ByVal NewValue As Integer)
  138.     m_OutBufferSize = NewValue
  139.     If m_PortOpen = True Then mComm.OutBufferSize = NewValue
  140. End Property
  141.  
  142. Public Property Get RTSEnable() As Boolean
  143.     RTSEnable = m_RTSEnable
  144. End Property
  145.  
  146. Public Property Let RTSEnable(ByVal NewValue As Boolean)
  147.     m_RTSEnable = NewValue
  148.     If m_PortOpen = True Then mComm.RTSEnable = NewValue
  149. End Property
  150.  
  151. Public Property Get CDHolding() As Boolean
  152.     If m_PortOpen = True Then CDHolding = mComm.CDHolding
  153. End Property
  154.  
  155. Public Property Get CTSHolding() As Boolean
  156.     If m_PortOpen = True Then CTSHolding = mComm.CTSHolding
  157. End Property
  158.  
  159. Public Property Get DSRHolding() As Boolean
  160.     If m_PortOpen = True Then DSRHolding = mComm.DSRHolding
  161. End Property
  162.  
  163. Private Sub Class_Terminate()
  164.     Set mComm = Nothing
  165. End Sub
  166.  
  167. Public Property Get CommEvent() As Integer
  168.     CommEvent = m_CommEvent
  169. End Property
  170.  
  171. Private Sub mComm_OnComm()
  172.     m_CommEvent = mComm.CommEvent
  173.     m_CommEvent = 0
  174. End Sub
  175.  
  176. Public Property Get RThreshold() As Integer
  177.     RThreshold = mComm.RThreshold
  178. End Property
  179.  
  180. Public Property Let RThreshold(ByVal NewValue As Integer)
  181.     mComm.RThreshold = NewValue
  182. End Property

Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.
↑  ↓

#7 04.04.2014 20:18
Gjoreski Van mreze
Administrator
Registrovan od:02.02.2009
Postovi:1,854


Predmet:Re: Clasa Vo Access
Ova ne odi nesto eve primer

Prilozi:
Informacije o tipu datoteke za:rar  New Microsoft Office Access Application.rar
Preuzimanja:212
Velicina datoteke:16.46 KB

↑  ↓

#8 04.04.2014 21:57
zxz Van mreze
Administrator
Registrovan od:03.02.2009
Postovi:10,644


Predmet:Re: Clasa Vo Access
Pa nisi ukljucio u referencama mscomm32.ocx.
Nemoze bez njega jer ovo je klasa za njega.
Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.
↑  ↓

#9 05.04.2014 01:49
Gjoreski Van mreze
Administrator
Registrovan od:02.02.2009
Postovi:1,854


Predmet:Re: Clasa Vo Access
ja ukluciv ama ne raboti
↑  ↓

#10 08.04.2014 08:56
zxz Van mreze
Administrator
Registrovan od:03.02.2009
Postovi:10,644


Predmet:Re: Clasa Vo Access
Uf u ovom tvome kodu ima jos objekata koje ja nemogu da prepoznam sta su.
Evo ti moj primjer pa probaj.

Prilozi:
Informacije o tipu datoteke za:zip  ComPort.zip
Preuzimanja:230
Velicina datoteke:12.28 KB


Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.
↑  ↓

Stranice (2):1,2


Sva vremena su GMT +01:00. Trenutno vrijeme: 8: 42 pm.