»áÔ±£º ÃÜÂ룺 ¡¡Ãâ·Ñ×¢²á | Íü¼ÇÃÜÂë | »áÔ±µÇ¼ ÍøÒ³¹¦ÄÜ£º ¼ÓÈëÊÕ²Ø ÉèΪÊ×Ò³ ÍøÕ¾ËÑË÷  
 °²È«¼¼Êõ¼¼ÊõÎĵµ
  ¡¤ °²È«ÅäÖÆ
  ¡¤ ¹¤¾ß½éÉÜ
  ¡¤ ºÚ¿Í½Ìѧ
  ¡¤ ·À»ðǽ
  ¡¤ Â©¶´·ÖÎö
  ¡¤ ÆƽâרÌâ
  ¡¤ ºÚ¿Í±à³Ì
  ¡¤ ÈëÇÖ¼ì²â
 °²È«¼¼ÊõÂÛ̳
  ¡¤ °²È«ÅäÖÆ
  ¡¤ ¹¤¾ß½éÉÜ
  ¡¤ ·À»ðǽ
  ¡¤ ºÚ¿ÍÈëÇÖ
  ¡¤ Â©¶´¼ì²â
  ¡¤ Æƽⷽ·¨
  ¡¤ É±¶¾×¨Çø
 °²È«¼¼Êõ¹¤¾ßÏÂÔØ
  ¡¤ É¨Ã蹤¾ß
  ¡¤ ¹¥»÷³ÌÐò
  ¡¤ ºóÃÅľÂí
  ¡¤ ¾Ü¾ø·þÎñ
  ¡¤ ¿ÚÁîÆƽâ
  ¡¤ ´úÀí³ÌÐò
  ¡¤ ·À»ðǽ
  ¡¤ ¼ÓÃܽâÃÜ
  ¡¤ ÈëÇÖ¼ì²â
  ¡¤ ¹¥·ÀÑÝʾ
¼¼ÊõÎĵµ > VBÎĵµ > ϵͳ¿ØÖÆ
VB¶ÔµÍ²ãÓ²¼þµÄ·ÃÎÊ¿ØÖÆ
·¢±íÈÕÆÚ£º2003-07-21 00:00:00×÷ÕߣºÍ ³ö´¦£º  

---- VBûÓÐÌṩֱ½Ó·ÃÎʵͲãÓ²¼þµÄ¿Ø¼þºÍ·½·¨£¬Ò»¶È¸ø¶Ô·ÃÎÊÓ²¼þ¸ÐÐËȤµÄ±à³ÌÕß´øÀ´²»±ã¡£Ä¿Ç°ÎÒÃÇ¿É´ÓÍøÉÏËÑË÷µ½Ö§³ÖµÍ²ãÓ²¼þ·ÃÎʵÄDLLºÍActiveX¿Ø¼þ£¬Í¨¹ýËüÃǿɶÁд´æ´¢Æ÷µ¥Ôª¡¢¶Ë¿Ú£¬ÉõÖÁ¿ØÖÆÓ²¼þÖжϡ£ÏÂÃæͨ¹ýÁ½¸öÀûÓÃDLLºÍActiveX¿Ø¼þʾÀý½éÉÜVB¶ÔµÍ²ãÓ²¼þµÄ·ÃÎÊ¿ØÖÆ¡£

---- Ò»¡¢ÀûÓÃDLL¶Áд¶Ë¿Ú

---- ÈôÔÚÓ¦ÓóÌÐòÖÐÖ»ÊǼòµ¥µØ¶Áд¶Ë¿Ú£¬ÀûÓÃDLL±à³ÌʵÏÖ½ÏΪ¼ò±ã¡£´Óhttp://personal.vsnl.com/srÍøÕ¾¿ÉÏÂÔØÒ»¸öÃâ·ÑµÄ32λVBIO.DLL£¬¸ÃÁ¬½Ó¿âÔÊÐíÔÚVB4¡¢5»ò6ÖÐʹÓ㬹²ÓÐÆ߸öº¯ÊýºÍ¹ý³Ì·Ö±ðΪ:

Anjan DLLµÄ½âËø¹ý³Ì

Inp ¶Ë¿Ú¶Á×Ö½Úº¯Êý

Inpw ¶Ë¿Ú¶Á×Öº¯Êý

Out ¶Ë¿Úд×Ö½Ú¹ý³Ì

Outw ¶Ë¿Úд×Ö¹ý³Ì

GetLptBaseAddr »ñÈ¡²¢¿Ú»ùµØÖ·µÄº¯Êý

GetComBaseAddr »ñÈ¡´®¿Ú»ùµØÖ·µÄº¯Êý

---- ͼ1ÊÇÒ»¸ö·¢ÉùʾÀý³ÌÐòµÄ´°Ì壬ÔÚÊäÈë¿òÖмüÈëһƵÂÊÖµ²¢°´SoundOnÅ¥£¬ÔòÔÚPC»úµÄÑïÉùÆ÷Öз¢³öÖ¸¶¨ÆµÂÊÒôµ÷£¬³ÌÐòÖжÔÒôµ÷µÄ±ä»¯¡¢ÉùÒôµÄ¿ª¹ØÊÇÓÃVBIO.DLLµÄ¹ý³ÌºÍº¯Êý·ÃÎÊ·¢ÉùϵͳµÄ¶¨Ê±Æ÷/¼ÆÊýÆ÷ºÍ¿ØÖƶ˿ÚʵÏֵġ£±à³ÌÒªµã£º1¡¢Ó¦ÔÚForm _LoadÖмÓÈëAnjan½âËø¹ý³Ì¡£2¡¢ÈôÔÚÄ£¿éÖÐÉùÃ÷º¯ÊýºÍ¹ý³Ì£¬Ó¦È¥µôprivate»òÓÃPublicÌæ´ú¡£3¡¢VBIO.DLLÓ¦¿½±´µ½windowssystem×ÓĿ¼Ï¡£

---- ³ÌÐòÇåµ¥£º

Option Explicit

Private Declare Sub

Anjan Lib "vbio.dll" ()

Private Declare Function

Inp Lib "vbio.dll" (ByVal port&) As Integer

Private Declare Function

Inpw Lib "vbio.dll" (ByVal port&) As Long

Private Declare Sub

Out Lib "vbio.dll" (ByVal port&, ByVal byt%)

Private Declare Sub

Outw Lib "vbio.dll" (ByVal port&, ByVal wrd&)

Private Declare Function

GetLptBaseAddr Lib "vbio.dll" (ByVal lpt&) As Integer

Private Declare Function

GetComBaseAddr Lib "vbio.dll" (ByVal com&) As Integer

Public Sub SetFreq(soundHz As Integer)

¡¯ÉèÖÃƵÂÊ

If soundHz Then

Dim divisor As Long

divisor = 1193180 / soundHz

'¼ÆËãʱ¼ä³£Êý

Out &H42, &HB6

'8253-5ͨµÀ2ÉèÖÃΪ·½Ê½3

Out &H42, divisor Mod 256

'ËÍʱ¼ä³£Êý

Out &H42, divisor 256

'

Speaker True

Else

Speaker False

End If

End Sub

Public Sub Speaker(sOn As Boolean)

¡¯¿ª¹ØÉùÒô

Dim portVal As Integer

portVal = Inp(&H61)

'

If sOn Then

portVal = portVal Or 3

'µÍλΪͨµÀ2µÄÃÅ¿ØÐźÅ

Else

'´ÎµÍλΪÕûÐÎÓëÃÅ¿ØÖÆÐźÅ

portVal = portVal And (Not 3)

End If

Out &H61, portVal

End Sub

Private Sub Form_Load()

Anjan

¡¯Èí¼þ½âËø

End Sub

Private Sub SoundOff_Click()

Speaker False

End Sub

Private Sub SoundOn_Click()

SetFreq Val(TextHz)

End Sub

---- ¶þ¡¢ÀûÓÃActiveX´¦ÀíÓ²¼þÖжÏ

---- ÔÚÓ¦ÓóÌÐòÖÐÈç¹ûÐèÒª·ÃÎÊ´æ´¢µ¥Ôª¡¢¶Ë¿ÚÒÔ¼°´¦ÀíÓ²¼þÖжϣ¬Ê¹ÓÃTVicHW32 ActiveX¿Ø¼þÊÇÒ»ºÜºÃµÄÑ¡Ôñ£¬¸Ã¿Ø¼þÊÇÒ»¸ö¹²ÏíÈí¼þ£¬Ö§³ÖWindows 95/98/NT£¬¿É´Óhttp://www.entechtaiwan.com/tools.htm´¦ÏÂÔØ¡£¸Ã¿Ø¼þ³ý¾ß±¸Ö±½Ó·ÃÎÊ´æ´¢µ¥ÔªºÍ¶Ë¿ÚµÄ¹¦ÄÜÍ⣬»¹ÌṩÁ˷ḻµÄ´¦Àí²¢¿ÚµÄÊôÐԺͷ½·¨£¬ÒÔ¼°´¦ÀíÓ²¼þÖжϵÄÊôÐÔ¡¢·½·¨ºÍʼþ£¬¼«´óµØÍØÕ¹ÁËVB¶ÔµÍ²ãÓ²¼þµÄ·ÃÎÊ¿ØÖÆ¡£ÏÂÃæͨ¹ýÒ»¸öÏÔʾ¼üÅÌÖжϴÎÊýºÍ°´¼üɨÃèÂëµÄʾÀý½éÉܿؼþµÄʹÓùý³Ì¡£

---- 1¡¢ÏÂÔØTVicHW32ѹËõÈí¼þ°ü²¢½âѹµ½Ò»¸öĿ¼ÖУ¬ÈçHW¡£°Ñdriver×ÓĿ¼ÏµÄvichw00.vxdÎļþ¿½±´µ½windowssystem×ÓĿ¼Ï£¬¸ÃÎļþÊǿؼþ·ÃÎÊÓ²¼þµÄÇý¶¯³ÌÐò£¬Ê¹ÓÿؼþÇ°ÏÈÓÃOpenDriver´ò¿ª£¬×îºóÓÃClose_Driver·½·¨¹Ø±Õ¡£

---- 2¡¢°Ñocx×ÓĿ¼ÏµÄtvichw32.ocx¿½±´µ½windowssystem×ÓĿ¼Ï£¬²¢ÔÚDOSÃüÁîÐÐ״̬ϼüÈëÒÔÏÂÃüÁî½øÐÐ×¢²á¡£

---- regsvr32 tvichw32.ocx

---- 3 ¡¢ÔÚVB»·¾³ÏÂͨ¹ý²Ëµ¥¹¤³Ì--²¿¼þ--¿Ø¼þ²¢Ñ¡ÔñTVicHW32 ActiveX Control Module½«¿Ø¼þÌí¼Óµ½¹¤¾ßÏäÖС£

---- 4¡¢Ïà¹ØµÄÊôÐÔ¡¢·½·¨¼°Ê¼þ

---- ·½·¨ OpenDriver ´ò¿ªÖ§³Ö·ÃÎÊÓ²¼þµÄÇý¶¯³ÌÐòvichw.vxd£¨windows95Ï£©

---- ·½·¨ CloseDriver ¹Ø±ÕÇý¶¯³ÌÐò

---- ÊôÐÔ ActiveHW As Bool Çý¶¯³ÌÐò´ò¿ªÔòΪTrue;¹Ø±ÕΪFalse ÖжÏʼþ OnHwInterrupt(ByVal HwCounter As Long,

ByVal LPT_DataReg As Integer,

ByVal LPT_StatusReg As Integer,

ByVal ScanCode As Integer

)

²ÎÊý

HwCounter : ÖжϴÎÊý

LPT_DataReg : Èç¹ûʹÓÃIRQ7£¬ÔòΪ´òÓ¡²¢¿ÚµÄÊý¾Ý

LPT_StatusReg : Èç¹ûʹÓÃIRQ7£¬ÔòΪ´òÓ¡²¢¿ÚµÄÊý¾Ý

ScanKode : Èç¹ûʹÓÃIRQ1£¬ÔòΪ°´¼üµÄɨÃèÂë

ÊôÐÔ IRQNumber Ö¸¶¨ÖжϺţ¬·¶Î§IRQ1--15

ÊôÐÔ IRQMasked ÖжϷÇÆÁ±ÎÔòΪTrue£»ÆÁ±ÎΪFalse

---- ͼ2(ÂÔ)ÊÇʾÀýµÄ´°Ì壬³ÌÐòÔËÐкóÊ×ÏÈ°´Open_DriverÅ¥´ò¿ªÇý¶¯³ÌÐò£¬È»ºóÑ¡ÔñUnmarsk¸´Ñ¡¿ò¿ª·ÅÖжϣ¬´Ëʱÿ°´Ò»´Î¼ü¿òÖзֱðÏÔʾ¸Ã¼üµÄɨÃèÂëºÍÖжϴÎÊý¡£´¦ÀíÆäËüÖжÏÖ»Ðè¸ü¸ÄÖжϺż´¿É£¨ÖжϺÅ1--15£©¡£

---- ³ÌÐòÇåµ¥£º

Public Sub ShowButtons()

Open_Driver.Enabled = Not HwCtrl.ActiveHW

Close_Driver.Enabled = HwCtrl.ActiveHW

B_Unmask.Enabled = HwCtrl.ActiveHW

End Sub

Private Sub Form_Load()

ShowButtons

End Sub

Private Sub Open_Driver_Click()

HwCtrl.OpenDriver '´ò¿ªÇý¶¯³ÌÐò

If Not HwCtrl.ActiveHW Then

MsgBox ("The driver VICHWxx not found")

Else:

HwCtrl.IRQNumber = 1 'ÖжϺÅΪ1,¼üÅÌÖжÏ

End If

ShowButtons

End Sub

Private Sub Close_Driver_Click()

HwCtrl.CloseDriver '¹Ø±ÕÇý¶¯³ÌÐò

B_Unmask.Value = 0

ShowButtons

End Sub

Private Sub B_Unmask_Click()

If B_Unmask.Value = 0 Then

HwCtrl.IRQMasked = True

Else

HwCtrl.IRQNumber = 1

Scan_Code = 0

HwCtrl.IRQMasked = False '¿ª·ÅÖжÏ

End If

End Sub

Private Sub HwCtrl_OnHwInterrupt(ByVal HwCounter

As Long, ByVal LPT_DataReg As Integer, ByVal

LPT_StatusReg As Integer, ByVal ScanCode As Integer)

Scan_Code.Caption = ScanCode

IRQC.Caption = HwCounter

End Sub

¡¾·µ»Ø¶¥²¿¡¿ ¡¾´òÓ¡±¾Ò³¡¿ ¡¾¹Ø±Õ´°¿Ú¡¿

¹ØÓÚÎÒÃÇ / ¸øÎÒÁôÑÔ / °æȨ¾Ù±¨ / Òâ¼û½¨Òé / ÍøÕ¾±à³ÌQQȺ   
Copyright ©2003- 2024 Lihuasoft.net webmaster(at)lihuasoft.net ¼ÓÔØʱ¼ä 0.00158