tailieunhanh - Parallel Port Complete- P5

Parallel Port Complete- P5: From its origin as a simple printer interface, the personal computer's parallel port has evolved into a place to plug in just about anything you might want to hook to a computer. The parallel port is popular because it's versatile-you can use it for output, input, or bidirectional links-and because it's available-every PC has one. | Programming Tools Sub GetIniData Use the Windows API call GetPrivateProfileString to read user information from an ini file. Dim NumberOfCharacters Dim ReturnBuffer As String 128 Dim Index Dim WindowsDirectory Get the Windows directory where the ini file is stored. NumberOfCharacters GetWindowsDirectory ReturnBuffer 127 WindowsDirectory Left ReturnBuffer NumberOfCharacters IniFile WindowsDirectory If the ini file doesn t exist don t try to read it. If Not Dir IniFile Then The port addresses Port O .Address _ CInt VbGetPrivateProfileString Iptdata PortOAddress IniFile Port l .Address _ CInt VbGetPrivateProfileString Iptdata PortlAddress IniFile Port 2 .Address _ CInt VbGetPrivateProfileString Iptdata Port2Address IniFile Port 3 .Address _ CInt VbGetPrivateProfileString Iptdata Port3Address IniFile The port types Port O .PortType _ VbGetPrivateProfileString Iptdata PortOType IniFile Port l .PortType _ VbGetPrivateProfileString Iptdata PortlType IniFile Port 2 .PortType _ VbGetPrivateProfileString Iptdata Port2Type IniFile Port 3 .PortType _ VbGetPrivateProfileString Iptdata Port3Type IniFile Listing 4-4 Code for finding and testing ports and getting and saving initialization data from an n file. Sheet 3 of 14 Parallel Port Complete 69 Please purchase PDF Split-Merge on to remove this watermark. Chapter 4 Port enabled Port O .Enabled _ CInt VbGetPrivateProfileString Iptdata PortOEnabled IniFile Port 1 .Enabled _ CInt VbGetPrivateProfileString Iptdata PortlEnabled IniFile Port 2 .Enabled _ CInt VbGetPrivateProfileString Iptdata Port2Enabled IniFile Port 3 .Enabled _ CInt VbGetPrivateProfileString Iptdata Port3Enabled IniFile The selected port IndexOfSelectedPort _ Int VbGetPrivateProfileString Iptdata IndexOfSelectedPort IniFile End If End Sub Function ReadEcpMode TestAddress The Ecr mode is in bits 5 6 and 7 of the ECR. EcrAddress TestAddress H402 EcrData Inp EcrAddress ReadEcpMode EcrData And HE0 H20 End Function Function .