Ò»¡¢¸ÅÊö
´®¿ÚͨѶ×÷ΪһÖÖ¹ÅÀ϶øÓÖÁé»îµÄͨѶ·½Ê½£¬±»¹ã·ºµØÓ¦ÓÃÓÚPC¼äµÄͨѶÒÔ¼°PCºÍµ¥Æ¬»úÖ®¼äµÄͨѶ֮ÖС£ Ìáµ½´®¿ÚͨѶµÄ±à³Ì£¬ÈËÃÇÍùÍùÁ¢¿ÌÏëµ½C¡¢»ã±àµÈ¶Ôϵͳµ×²ã²Ù×÷Ö§³Ö½ÏºÃµÄ±à³ÌÓïÑÔÒÔ¼°´ó´®·±ËöµÄ´úÂë¡£
ʵ¼ÊÉÏ£¬Ö»ÒªÎÒÃǽèÖúÏà¹ØActiveX¿Ø¼þµÄ°ïÖú£¬¼´Ê¹ÊÇÔڵײã²Ù×÷Ò»Ïò²»±»ÈË¿´ºÃµÄVBÖУ¬Ò»ÑùÄܹ»ÊµÏÖ´®¿Úͨ Ѷ£¬ÉõÖÁÆäʵÏÖ·½·¨ºÍC¡¢»ã±àÏà±È£¬Òª¸ü¼Ó¿ì½Ý·½±ã¡£ÏÂÃ棬±ÊÕ߾ͽéÉÜÒ»ÏÂÔÚVBÖÐʵÏÖ´®¿ÚͨѶµÄ·½·¨¡£
ÔÚVisual BasicÖÐÓÐÒ»¸öÃûΪMicrosoft Communication Control£¨¼ò³ÆMSComm£©µÄͨѶ¿Ø¼þ¡£ÎÒÃÇֻҪͨ ¹ý¶Ô´Ë¿Ø¼þµÄÊôÐÔºÍʼþ½øÐÐÏàÓ¦±à³Ì²Ù×÷£¬¾Í¿ÉÒÔÇáËɵØʵÏÖ´®¿ÚͨѶ¡£ÏÂÃ棬±ÊÕ߾ͼòÒªµØ½éÉÜÒ»ÏÂ
MSComm¿Ø¼þµÄʹÓ÷½·¨¡£
¶þ¡¢MSComm¿Ø¼þµÄÖ÷ÒªÊôÐÔ¡¢Ê¼þ
1¡¢MSCommµÄÊôÐÔ
ÓÉÓÚMSComm¿Ø¼þÊôÐԺܶ࣬Ôڴ˱ÊÕß½ö½éÉÜÓëʵÏÖ´®¿ÚͨѶÃÜÇÐÏà¹ØµÄºËÐÄÊôÐÔ¡£
Commport£ºÉèÖÃͨѶËùÕ¼ÓõĴ®¿ÚºÅ¡£ÈçÉè³É1£¨Ä¬ÈÏÖµ£©£¬±íʾ¶ÔCom1½øÐвÙ×÷¡£
Setting£º¶Ô´®¿ÚͨѶµÄÏà¹Ø²ÎÊý¡£°üÀ¨´®¿ÚÍ ......
Ò»°ãÀ´Ëµ£¬ÔÚVBÖбàд´®¿ÚͨѶ³ÌÐò£¬Ê×ÏÈ¿¼Âǵ½ÊÇʹÓÃMSComm¿Ø¼þ£¬¿ÉÊǸÿؼþ²»ÄÜÉèÖó¬Ê±£¬¶øÇÒ¶ÔÐí¶àÄÚ²¿µÄ²ÎÊý½øÐÐÁËÒþ²Ø£¬´Ó¶ø²»ÄÜÂú×ãÓÐЩ¾ßÌåµÄ¹¤×÷¡£¶øʹÓÃAPI½øÐд®¿ÚͨÐÅ£¬´ó¶àÊÇʹÓÃVC£¬ºÜÉÙ¼ûµ½ÍêÕûµÄVB´úÂ룬Ϊ´Ë£¬ÎÒ±àдÁËÕâ¸öÄ£¿é¡£
ͬʱ£¬ÓÉÓÚ´®¿ÚͨÐÅÊÇ»ùÓÚ×Ö½ÚÁ÷µÄ£¬Îª·½±ã³ÌÐòÉè¼Æ£¬»¹±àдÁËÈý¸ö¼òµ¥µÄ¸¨Öúº¯Êý£¬²¢Ð´ÁËÒ»¸öÏêϸµÄ²âÊÔ´úÂë¡£
¾ßÌå´úÂëÈçÏ£º
Option Explicit
Option Base 0
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, ByVal lpOverlapped As Long) ......