⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 as_ocx.txt

📁 TvicHW32(评估版)另一个编写驱动程序的实用工具(497KB)
💻 TXT
字号:
NOTE! Make sure that you have these libraries
on your hard disk:

MFC42.DLL
MSVCRT.DLL
OLEAUT32.DLL

                           TVicHW32 version 3.0
                           ====================

                   Copyright (C) 1997,1998 Victor Ishikeev
                     e-mail: ivi@ufanet.ru, tools@entechtaiwan.com
                     http://www.entechatiwan.com/tools.htm

                             AS_OCX.TXT
                             ==========


CONTENTS
========

1. GENERAL TVicHW32 ActiveX COMPONENT PROPERTIES AND METHODS
2. DIRECT MEMORY ACCESS WITH TVicHW32 (NEW features!)
3. DIRECT PORT I/O WITH TVicHW32
4. HARDWARE INTERRUPT HANDLING WITH TVicHW32 (NEW features!)
5. SPECIFIC WORK WITH THE LPT PORT (NEW!)
6. CONTACT INFORMATION


1. GENERAL TVicHW32 ActiveX COMPONENT PROPERTIES AND METHODS
============================================================

After successfully adding the TVicHW32 component to your component 
palette, and after copying the kernel-mode driver(s) to the appropriate 
Windows directories, you can test the functionality of the component, 
and examine the sample code provided, by opening the included project1
demonstration program.

TVicHW32 has the following general component properties and methods:

    Sub OpenDriver
    ---------------------
    Loads the vichwXX.vxd (under Windows 95) or vichwXX.sys (under 
    Windows NT) kernel-mode driver, providing direct access to the 
    hardware. If the kernel-mode driver was successfully opened, the
    boolean ActiveHW property (see below) will be set to True; if the 
    procedure fails, the ActiveHW property will be False.

    Sub CloseDriver
    ----------------------
    Closes the kernel-mode driver and releases memory allocated to it.
    If a hardware interrupt was "unmasked", the "mask" is restored. If the
    driver was successfully closed, the ActiveHW property (see below) will
    be set to False.

    property ActiveHW As Bool (published, read only )
    ----------------------------------------------
    The read-only and run-time ActiveHW property specifies whether the
    kernel-mode driver is open. ActiveHW returns True if the driver is
    open, or False if it is not.


2. DIRECT MEMORY ACCESS WITH TVicHW32
=======================================

The following properties and methods permits direct memory acccess:

    Fun MapPhysToLinear (PhAddr As Long, PhSize As Long) As Long
    ---------------------------------------- ------------------------
    Maps a specific physical address to a pointer in linear memory, where 
    PhAddr is the base address and Size is the actual number of bytes to 
    which access is required. In Visual Basic you can not use the pointer 
    returned by MapPhysToLinear() directly byt this pointer can be used in 
    Mem(), MemW() and in MemL() properties (NEW! see below). For more
    info see a test example provided with this archive.

    NEW! Now you can get up 16 of valid pointers to various physical 
    ===  addresses.

    For access to the predefined memory area, TVicHW32 3.0 provides an 
    implementation for three properties named  Mem, MemW and MemL

    property    Mem(MappedAddress As Long, Offset As Long) As Integer (read, write)
    -------------------------------------------------------------------------------
    This property allows read/write one byte  from the array type Byte
    based at given linear  address: Result = Mem(Base, index). 
    "Index" value should begin from the "0" value.
    In general, "Base" can be any valid linear pointer to the memory. But 
    if this pointer was received from the MapPhysToLinear() function then 
    you can access physical memory also.

    When a value is assigned to an property Mem, MemW or MemL the value 
    is output to the memory. When an property is referenced in an expression, 
    its value is input from the selected memory. Use of Mem, MemW or MemL
    are restricted to assignment and reference in  expressions only.


    property    MemW(MappedAddress As Long, Offset As Long) As Integer (read, write)
    -------------------------------------------------------------------------------
    This property allows read/write two bytes from the array type WORD
    based at given linear  address: Result = MemW(Base, index). 
    "Index" value should begin from the "0" value.
    In general, "Base" can be any valid linear pointer to the memory. But 
    if this pointer was received from the MapPhysToLinear() function then 
    you can access physical memory also.

    property    MemL(MappedAddress As Long, Offset As Long) As Long (read, write)
    -------------------------------------------------------------------------------
    This property allows read/write  four bytes  from the array type Long
    based at given linear  address: Result = MemL(Base, index). 
    "Index" value should begin from the "0" value.
    In general, "Base" can be any valid linear pointer to the memory. But 
    if this pointer was received from the MapPhysToLinear() function then 
    you can access physical memory also.


3. DIRECT PORT I/O WITH TVicHW32
==================================

For access to the 80x86 CPU data ports, TVicHW32 provides an implementation of
the properties named Port, PortW and PortL  and a "Hard/Soft" boolean switch.

When a value is assigned to an property of type Port, PortW, or PortL, the value 
is output to the selected port. When an property of type Port, PortW or PortL is 
referenced in an expression, its value is input from the selected port. Use of 
the Port, PortW and PortL properties are restricted to assignment and reference 
in expressions only.

The following properties permit direct I/O port access:

The following properties permit direct I/O port access:

    property Port(PortAddr As Integer) As Integer (read, write)
    -----------------------------------------------------------
    Value of the Port property really is of type Byte.

    property PortW(PortAddr As Integer) As Integer (read, write)
    -----------------------------------------------------------
    Value of the PortW property really is of type Integer(Word).

    property PortL(PortAddr As Integer) As Long (read, write)
    -----------------------------------------------------------
    Value of the Port property is of type Long (DWORD).

For more info about port I/O look at test exaple provided with
this archive.


4. HARDWARE INTERRUPT HANDLING WITH TVicHW32 (NEW features!)
============================================================

In a Win32 environment, hardware interrupts are normally hidden or "masked" 
by Windows; the TVicHW32 kernel-mode driver allows you to "unmask" the 
interrupt for direct handling by your application. Note that only one 
interrupt can be handled at a time.

The following properties and methods permit access to hardware interrupts.

For the installation of your interrupt handler just double click to the
TVicHW32 icon on your form. This notification event that a specific hardware 
interrupt has occurred.

Sub OnHwInterrupt(ByVal HwCounter As Long, 
                  ByVal LPT_DataReg As Integer, 
                  ByVal LPT_StatusReg As Integer, 
                  ByVal ScanCode As Integer
                  )
Here:

    HwCounter       : shows how many interruption was processed in the driver.
    LPT_DataReg     : if used IRQ7 then driver reads base LPT port (data)
    LPT_StatusReg   : if used IRQ7 then driver reads status LPT register(base+2)
    Keyb_ScanKode   : if used IRQ1 then driver allows you see all keystrokes
                      (scan codes) from the keyboard.

    property IRQNumber As Byte (read, write)
    ----------------------------------------
    Specifies which hardware interrupt (IRQ1..15) is to be unmasked for 
    processing. Note that IRQ0 (the system timer) is *not* supported.

    property IRQMasked As Boolean (read, write)
    -------------------------------------------

    Unmasks (IRQMasked = True) or masks the hardware interrupt specified 
    by the IRQNumber property, so that an OnHwInterrupt event will be generated 
    when a hardware interrupt occurs.
    You can read this property when you want check if current IRQ masked or not. 


5. SPECIFIC WORK WITH THE LPT PORT (NEW!)
=========================================

Now TVicHW32 provides extended properties and methods for work with the
printer (LPT) port.   

==== BASE ====

    property LPTNumPorts As Integer (read only)
    -------------------------------------------
    Shows how many LPT ports are installed on your PC.

    property LPTNumber As Integer (read, write, default 1);
    -----------------------------------------------------------
    Allows select a current LPT port.

    property LPTBasePort As Integer (read only );
    --------------------------------------------
    Returns a base address of the current LPT port.

==== PINS ====

    property Pin(nPin As Integer) As Boolean; (read, write)
    -------------------------------------------------------
    Allows : 1) Read an electrical level from the select pin of
             current LPT port. Returns TRUE if current level is HIGH
             2) Write an electrical level to the selected pin.
                TRUE - HIGH level.
    Note: Not all pins are accessible for this operation. Run test example
          for more info.

==== STATUS ====

    property LPTAckwl As Boolean (read only)
    ------------------------------------------
    Returns ACKWL state from the printer

    property LPTBusy As Boolean ( read only )
    ------------------------------------------
    Returns BUSY state from the printer

    property LPTPaperEnd As Boolean ( read only )
    --------------------------------------------
    Returns PAPER END state from the printer
    
    property LPTSlct As Boolean ( read only )
    ------------------------------------------
    Returns SLCT state from the printer

    property LPTError As Boolean ( read only )
    ------------------------------------------
    Returns ERROR state from the printer

=== COMMANDS ===

    Sub LPTStrobe
    -------------
    Sends STROBE signal to the printer

    Sub LPTAutofd(Flag As Boolean)
    ------------------------------
    Sets current AUTOFD  state on printer

    Sub LPTInit
    -----------
    Resets printer by sending INIT signal

    Sub LPTSlctIn
    -------------
    Sends SLCTIN signal to the printer

    Fun LPTPrintChar(ch As Integer) As Boolean
    ------------------------------------------
    Sends one symbol to the printer. Returns TRUE if
    successed. Otherwise you need repeat this operation.   
    
6. CONTACT INFORMATION
======================

Comments, questions and suggestions regarding TVicHW32 can be directed
by e-mail to tools@entechtaiwan.com.

With best wishes,

Victor Ishikeev
March 1998

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -