Removed unused files.
This commit is contained in:
parent
ec6eebb2a5
commit
8c8a42af36
12 changed files with 0 additions and 2171 deletions
BIN
drivers/CYBERCOM.DRV
(Stored with Git LFS)
BIN
drivers/CYBERCOM.DRV
(Stored with Git LFS)
Binary file not shown.
|
|
@ -1,101 +0,0 @@
|
||||||
CyberCom V1.1.0.0P
|
|
||||||
|
|
||||||
CYBERCOM.DRV 9264 11-26-93 1:06p
|
|
||||||
|
|
||||||
The High Speed Serial Communications Driver for Windows 3.1
|
|
||||||
Designed for 386 (and above) systems using the 16550 serial port
|
|
||||||
chip. (C) CyberSoft Corp 1993
|
|
||||||
|
|
||||||
Requires Windows 3.1, Enhanced Mode, a 16550 UART
|
|
||||||
|
|
||||||
|
|
||||||
INTRODUCTION.
|
|
||||||
-------------
|
|
||||||
CyberCom is a direct replacement for the standard Windows
|
|
||||||
Communications Driver (COMM.DRV).
|
|
||||||
|
|
||||||
* Transfer at up to 115,200 KB with a 16550 serial port chip
|
|
||||||
* Great for V.FAST and Voice modems that require 57,600 Kb
|
|
||||||
* More reliable Transfer with less overhead on your system - Better
|
|
||||||
background operation.
|
|
||||||
* Fewer (if any) over/under runs.
|
|
||||||
|
|
||||||
|
|
||||||
HOW DOES IT WORK?
|
|
||||||
-----------------
|
|
||||||
Don't worry if the following sounds too complicated - just skip over
|
|
||||||
it and move on to the Installation...
|
|
||||||
|
|
||||||
* CyberCom enables the FIFO buffer on the 16550 to be enabled for both
|
|
||||||
receive AND transmit - COMM.DRV only enables the FIFO for receive.
|
|
||||||
|
|
||||||
* The 'interrupt trigger level' has been set to 8 for both transmit and
|
|
||||||
receive. This gives your applications a lot more time to process
|
|
||||||
incoming information. COMM.DRV sets the trigger level to 14 which
|
|
||||||
means that your application only has 2 characters in which read from
|
|
||||||
the FIFO buffer.
|
|
||||||
|
|
||||||
What this means is that your communications applications will get far
|
|
||||||
fewer (if any) 'under runs' or 'over runs' when sending or receiving.
|
|
||||||
|
|
||||||
|
|
||||||
INSTALLATION
|
|
||||||
------------
|
|
||||||
1. Copy CYBERCOM.DRV into your Windows\System directory.
|
|
||||||
|
|
||||||
Edit the Windows\SYSTEM.INI file and change the following line:
|
|
||||||
|
|
||||||
From comm.drv=comm.drv
|
|
||||||
To comm.drv=cybercom.drv
|
|
||||||
|
|
||||||
2. If you previously have not taken advantage of the 16550 installed
|
|
||||||
in your computer then ensure that the Windows\SYSTEM.INI file has the
|
|
||||||
following information:
|
|
||||||
|
|
||||||
[386Enh]
|
|
||||||
COMnFIFO=1
|
|
||||||
|
|
||||||
where n is the number of the COM port.
|
|
||||||
|
|
||||||
if your 16550 is installed on, say, COM 1 then
|
|
||||||
|
|
||||||
[386Enh]
|
|
||||||
COM1FIFO=1
|
|
||||||
|
|
||||||
3. Start or Restart windows.
|
|
||||||
|
|
||||||
|
|
||||||
LICENCE
|
|
||||||
-------
|
|
||||||
CyberCom is provided free for non-commercial use.
|
|
||||||
|
|
||||||
You may not distribute CyberCom for profit. If you wish to include
|
|
||||||
CyberCom with your applications then contact CyberSoft at the address
|
|
||||||
below for details about royalty-free licences.
|
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
For further information, upgrades, problems etc please contact us at:
|
|
||||||
|
|
||||||
Attention: Douglas I. Scadlock
|
|
||||||
CyberSoft Corporation Pty Ltd,
|
|
||||||
PO BOX 407 Vaucluse,
|
|
||||||
New South Wales
|
|
||||||
2030 Australia
|
|
||||||
Phone +61 2 805 1077
|
|
||||||
Fax +61 2 805 0897
|
|
||||||
CIS 100033,1723
|
|
||||||
|
|
||||||
|
|
||||||
CAVEAT
|
|
||||||
------
|
|
||||||
THE INFORMATION AND COMMUNICATIONS DRIVER PROVIDED HEREUNDER
|
|
||||||
(COLLECTIVELY REFERRED TO AS "SOFTWARE") IS PROVIDED AS IS WITHOUT
|
|
||||||
WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
||||||
LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
(C) CyberSoft Corp 1993
|
|
||||||
(C) Microsoft Corp
|
|
||||||
|
|
||||||
**********************************************************************
|
|
||||||
Sydney 2000 - Home of the Millennium Games
|
|
||||||
BIN
vbx/kpcomctl.bmp
(Stored with Git LFS)
BIN
vbx/kpcomctl.bmp
(Stored with Git LFS)
Binary file not shown.
1104
vbx/kpcomctl.c
1104
vbx/kpcomctl.c
File diff suppressed because it is too large
Load diff
|
|
@ -1,16 +0,0 @@
|
||||||
; kpcomctl.def - Module definition for KPComCtl VBX control
|
|
||||||
|
|
||||||
LIBRARY KPCOMCTL
|
|
||||||
DESCRIPTION 'KPComCtl Serial Communications Control for VB4'
|
|
||||||
EXETYPE WINDOWS
|
|
||||||
|
|
||||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
|
||||||
DATA PRELOAD MOVEABLE SINGLE
|
|
||||||
|
|
||||||
HEAPSIZE 1024
|
|
||||||
|
|
||||||
EXPORTS
|
|
||||||
WEP @1 RESIDENTNAME
|
|
||||||
VBINITCC @2
|
|
||||||
VBTERMCC @3
|
|
||||||
VBGetModelInfo @4
|
|
||||||
145
vbx/kpcomctl.h
145
vbx/kpcomctl.h
|
|
@ -1,145 +0,0 @@
|
||||||
// kpcomctl.h - KPComCtl VBX control definitions
|
|
||||||
//
|
|
||||||
// Property/event IDs, comm event constants, and control instance data.
|
|
||||||
|
|
||||||
#ifndef KPCOMCTL_H
|
|
||||||
#define KPCOMCTL_H
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Resource IDs
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define IDB_KPCOMCTL 8000
|
|
||||||
|
|
||||||
#ifndef RC_INVOKED
|
|
||||||
|
|
||||||
#include "vbapi.h"
|
|
||||||
#include "serial.h"
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// stdint types for MSVC 1.52 (shared with serial.h)
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#ifndef _STDINT_DEFINED
|
|
||||||
typedef short int16_t;
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
typedef long int32_t;
|
|
||||||
typedef unsigned long uint32_t;
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
typedef signed char int8_t;
|
|
||||||
#define _STDINT_DEFINED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Property indices (position in npproplist array)
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define IPROP_CTLNAME 0
|
|
||||||
#define IPROP_INDEX 1
|
|
||||||
#define IPROP_TAG 2
|
|
||||||
#define IPROP_COMMPORT 3
|
|
||||||
#define IPROP_SETTINGS 4
|
|
||||||
#define IPROP_PORTOPEN 5
|
|
||||||
#define IPROP_INPUT 6
|
|
||||||
#define IPROP_OUTPUT 7
|
|
||||||
#define IPROP_INBUFFERSIZE 8
|
|
||||||
#define IPROP_OUTBUFFERSIZE 9
|
|
||||||
#define IPROP_INBUFFERCOUNT 10
|
|
||||||
#define IPROP_OUTBUFFERCOUNT 11
|
|
||||||
#define IPROP_RTHRESHOLD 12
|
|
||||||
#define IPROP_STHRESHOLD 13
|
|
||||||
#define IPROP_HANDSHAKING 14
|
|
||||||
#define IPROP_INPUTLEN 15
|
|
||||||
#define IPROP_INPUTMODE 16
|
|
||||||
#define IPROP_DTRENABLE 17
|
|
||||||
#define IPROP_RTSENABLE 18
|
|
||||||
#define IPROP_CDHOLDING 19
|
|
||||||
#define IPROP_CTSHOLDING 20
|
|
||||||
#define IPROP_DSRHOLDING 21
|
|
||||||
#define IPROP_BREAK 22
|
|
||||||
#define IPROP_COMMEVENT 23
|
|
||||||
#define IPROP_NULLDISCARD 24
|
|
||||||
#define IPROP_EOFENABLE 25
|
|
||||||
#define IPROP_PARITYREPLACE 26
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Event indices (position in npeventlist array)
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define IEVENT_ONCOMM 0
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// CommEvent constants - Communication events
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define COM_EV_RECEIVE 1 // Received RThreshold bytes
|
|
||||||
#define COM_EV_SEND 2 // Transmit buffer has SThreshold space
|
|
||||||
#define COM_EV_CTS 3 // CTS line changed
|
|
||||||
#define COM_EV_DSR 4 // DSR line changed
|
|
||||||
#define COM_EV_CD 5 // CD (RLSD) line changed
|
|
||||||
#define COM_EV_RING 6 // Ring indicator detected
|
|
||||||
#define COM_EV_EOF 7 // EOF character received
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// CommEvent constants - Error events
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define COM_EVT_BREAK 1001 // Break signal received
|
|
||||||
#define COM_EVT_FRAME 1004 // Framing error
|
|
||||||
#define COM_EVT_OVERRUN 1006 // Hardware overrun
|
|
||||||
#define COM_EVT_RXOVER 1008 // Receive buffer overflow
|
|
||||||
#define COM_EVT_RXPARITY 1009 // Parity error
|
|
||||||
#define COM_EVT_TXFULL 1010 // Transmit buffer full
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Handshaking enum values
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define HS_NONE 0
|
|
||||||
#define HS_XONXOFF 1
|
|
||||||
#define HS_RTSCTS 2
|
|
||||||
#define HS_BOTH 3
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// InputMode enum values
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define INPUT_TEXT 0
|
|
||||||
#define INPUT_BINARY 1
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Control instance data
|
|
||||||
//
|
|
||||||
// Allocated by VB as cbCtlExtra bytes per control instance.
|
|
||||||
// Accessed via VBDerefControl(hctl).
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
typedef struct {
|
|
||||||
int16_t commId; // OpenComm handle (-1 = closed)
|
|
||||||
HWND hwndNotify; // Hidden notification window
|
|
||||||
int16_t commPort; // COM port number (1-16)
|
|
||||||
HSZ hszSettings; // Settings string "baud,parity,data,stop"
|
|
||||||
int16_t inBufferSize; // Receive buffer size in bytes
|
|
||||||
int16_t outBufferSize; // Transmit buffer size in bytes
|
|
||||||
int16_t rThreshold; // Receive event threshold (0=disabled)
|
|
||||||
int16_t sThreshold; // Send event threshold (0=disabled)
|
|
||||||
int16_t handshaking; // Handshaking mode (HS_*)
|
|
||||||
int16_t inputLen; // Bytes to read per Input (0=all)
|
|
||||||
int16_t inputMode; // Input mode (INPUT_TEXT/INPUT_BINARY)
|
|
||||||
int16_t commEvent; // Last comm event code
|
|
||||||
BOOL portOpen; // Port open state
|
|
||||||
BOOL dtrEnable; // DTR line enable
|
|
||||||
BOOL rtsEnable; // RTS line enable
|
|
||||||
BOOL breakState; // Break signal active
|
|
||||||
BOOL nullDiscard; // Discard null characters
|
|
||||||
BOOL eofEnable; // Watch for EOF character
|
|
||||||
BOOL ctsState; // Shadow state: CTS line level
|
|
||||||
BOOL dsrState; // Shadow state: DSR line level
|
|
||||||
BOOL cdState; // Shadow state: CD (RLSD) line level
|
|
||||||
HSZ hszParityReplace; // Parity error replacement character
|
|
||||||
} KpComCtlDataT;
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Hidden notification window class name
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define NOTIFY_CLASS "KpComCtlNotify"
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Global instance handle (set in LibMain)
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
extern HANDLE ghInstance;
|
|
||||||
|
|
||||||
#endif // RC_INVOKED
|
|
||||||
|
|
||||||
#endif // KPCOMCTL_H
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
// kpcomctl.rc - KPComCtl VBX resource script
|
|
||||||
//
|
|
||||||
// Defines the toolbox bitmap and version information for the VB IDE.
|
|
||||||
|
|
||||||
#include "kpcomctl.h"
|
|
||||||
#include <ver.h>
|
|
||||||
|
|
||||||
IDB_KPCOMCTL BITMAP kpcomctl.bmp
|
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
|
||||||
FILEVERSION 1,0,0,0
|
|
||||||
PRODUCTVERSION 1,0,0,0
|
|
||||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
|
||||||
FILEFLAGS 0
|
|
||||||
FILEOS VOS__WINDOWS16
|
|
||||||
FILETYPE VFT_DLL
|
|
||||||
FILESUBTYPE VFT2_UNKNOWN
|
|
||||||
BEGIN
|
|
||||||
BLOCK "StringFileInfo"
|
|
||||||
BEGIN
|
|
||||||
BLOCK "040904E4"
|
|
||||||
BEGIN
|
|
||||||
VALUE "CompanyName", "KP Software\0"
|
|
||||||
VALUE "FileDescription", "KPComCtl Serial Communications Control\0"
|
|
||||||
VALUE "FileVersion", "1.00\0"
|
|
||||||
VALUE "InternalName", "KPCOMCTL\0"
|
|
||||||
VALUE "OriginalFilename", "KPCOMCTL.VBX\0"
|
|
||||||
VALUE "ProductName", "KPComCtl\0"
|
|
||||||
VALUE "ProductVersion", "1.00\0"
|
|
||||||
END
|
|
||||||
END
|
|
||||||
BLOCK "VarFileInfo"
|
|
||||||
BEGIN
|
|
||||||
VALUE "Translation", 0x0409, 1252
|
|
||||||
END
|
|
||||||
END
|
|
||||||
81
vbx/makefile
81
vbx/makefile
|
|
@ -1,81 +0,0 @@
|
||||||
# makefile - KPComCtl VBX control for MSVC 1.52
|
|
||||||
#
|
|
||||||
# Build: nmake
|
|
||||||
# Clean: nmake clean
|
|
||||||
#
|
|
||||||
# Prerequisites:
|
|
||||||
# - MSVC 1.52 (cl, link, rc in PATH)
|
|
||||||
# - VBAPI.LIB (from VBX CDK - contains thunk stubs, NOT an import library)
|
|
||||||
#
|
|
||||||
# High-speed serial note:
|
|
||||||
# The stock Windows 3.1 COMM.DRV enables the 16550 FIFO for receive only,
|
|
||||||
# with a trigger level of 14 (leaving only 2 bytes of headroom). This causes
|
|
||||||
# overruns at baud rates above 9600 under load. For reliable operation at
|
|
||||||
# 57600 or 115200, install KPCOMM.DRV (built from ..\drv\) or CyberCom
|
|
||||||
# V1.1.0.0P (..\drivers\CYBERCOM.DRV).
|
|
||||||
#
|
|
||||||
# Install (KPCOMM):
|
|
||||||
# 1. Copy ..\drv\KPCOMM.DRV to \WINDOWS\SYSTEM
|
|
||||||
# 2. Edit SYSTEM.INI [boot] section: comm.drv=kpcomm.drv
|
|
||||||
# 3. Add to [386Enh] section: COM1FIFO=1 (for each port in use)
|
|
||||||
# 4. Restart Windows
|
|
||||||
|
|
||||||
CC = cl
|
|
||||||
LINK = link
|
|
||||||
RC = rc
|
|
||||||
|
|
||||||
# Compiler flags:
|
|
||||||
# -c Compile only
|
|
||||||
# -W3 Warning level 3
|
|
||||||
# -ASw Small model, SS!=DS (Windows DLL)
|
|
||||||
# -Gsw No stack probes, Windows prolog/epilog
|
|
||||||
# -Ow Safe optimizations for Windows
|
|
||||||
# -Zp2 Pack structures on 2-byte boundaries
|
|
||||||
# -Ze Enable Microsoft extensions
|
|
||||||
CFLAGS = -c -W3 -ASw -Gsw -Ow -Zp2 -Ze -IC:\MSVC\INCLUDE
|
|
||||||
|
|
||||||
# Linker flags:
|
|
||||||
# /NOD No default libraries
|
|
||||||
# /NOE No extended dictionary search
|
|
||||||
# /AL:16 Segment alignment 16
|
|
||||||
LFLAGS = /NOD /NOE /AL:16 /LI:C:\MSVC\LIB
|
|
||||||
|
|
||||||
# Libraries
|
|
||||||
# sdllcew Small model DLL C runtime (emulated math, Windows)
|
|
||||||
# libw Windows API import library
|
|
||||||
# commdlg Common dialog import library
|
|
||||||
# vbapi VB API thunk library (from VBX CDK)
|
|
||||||
LIBS = sdllcew libw commdlg vbapi
|
|
||||||
|
|
||||||
# Output
|
|
||||||
TARGET = kpcomctl.vbx
|
|
||||||
|
|
||||||
# Objects
|
|
||||||
OBJS = kpcomctl.obj serial.obj
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------
|
|
||||||
# Build rules
|
|
||||||
# -----------------------------------------------------------------------
|
|
||||||
all: $(TARGET)
|
|
||||||
|
|
||||||
$(TARGET): $(OBJS) kpcomctl.def kpcomctl.res
|
|
||||||
$(LINK) $(LFLAGS) $(OBJS), $(TARGET),,$(LIBS), kpcomctl.def
|
|
||||||
$(RC) kpcomctl.res $(TARGET)
|
|
||||||
|
|
||||||
kpcomctl.obj: kpcomctl.c kpcomctl.h vbapi.h serial.h
|
|
||||||
$(CC) $(CFLAGS) kpcomctl.c
|
|
||||||
|
|
||||||
serial.obj: serial.c serial.h
|
|
||||||
$(CC) $(CFLAGS) serial.c
|
|
||||||
|
|
||||||
kpcomctl.res: kpcomctl.rc kpcomctl.h kpcomctl.bmp
|
|
||||||
$(RC) -r -iC:\MSVC\INCLUDE kpcomctl.rc
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------
|
|
||||||
# Clean
|
|
||||||
# -----------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
-del *.obj
|
|
||||||
-del *.res
|
|
||||||
-del *.vbx
|
|
||||||
-del *.map
|
|
||||||
253
vbx/serial.c
253
vbx/serial.c
|
|
@ -1,253 +0,0 @@
|
||||||
// serial.c - Serial port abstraction layer
|
|
||||||
//
|
|
||||||
// Wraps Windows 3.1 comm API for use by the MSComm VBX control.
|
|
||||||
// All functions operate on a comm ID returned by serialOpen().
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "serial.h"
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Prototypes
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
int16_t serialClose(int16_t commId);
|
|
||||||
int16_t serialConfigure(int16_t commId, int16_t port, const char FAR *settings);
|
|
||||||
BOOL serialEnableNotify(int16_t commId, HWND hwnd, int16_t rxThreshold, int16_t txThreshold);
|
|
||||||
int16_t serialEscape(int16_t commId, int16_t func);
|
|
||||||
int16_t serialFlush(int16_t commId, int16_t queue);
|
|
||||||
UINT serialGetEventMask(int16_t commId, UINT mask);
|
|
||||||
int16_t serialGetStatus(int16_t commId, COMSTAT FAR *stat);
|
|
||||||
int16_t serialOpen(int16_t port, int16_t inBufSize, int16_t outBufSize);
|
|
||||||
int16_t serialRead(int16_t commId, char FAR *buf, int16_t len);
|
|
||||||
int16_t serialSetHandshaking(int16_t commId, int16_t mode);
|
|
||||||
int16_t serialSetOptions(int16_t commId, BOOL nullDiscard, const char FAR *parityReplace);
|
|
||||||
int16_t serialWrite(int16_t commId, const char FAR *buf, int16_t len);
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// serialClose - Close an open comm port
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
int16_t serialClose(int16_t commId)
|
|
||||||
{
|
|
||||||
// Drop DTR and RTS before closing
|
|
||||||
EscapeCommFunction(commId, CLRDTR);
|
|
||||||
EscapeCommFunction(commId, CLRRTS);
|
|
||||||
|
|
||||||
return (int16_t)CloseComm(commId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// serialConfigure - Set baud, parity, data bits, stop bits
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
int16_t serialConfigure(int16_t commId, int16_t port, const char FAR *settings)
|
|
||||||
{
|
|
||||||
DCB dcb;
|
|
||||||
char buf[64];
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
// Get current state to preserve existing settings
|
|
||||||
rc = GetCommState(commId, &dcb);
|
|
||||||
if (rc != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build DCB from "COMn:baud,parity,data,stop" string
|
|
||||||
wsprintf(buf, "COM%d:%s", (int)port, (LPSTR)settings);
|
|
||||||
rc = BuildCommDCB(buf, &dcb);
|
|
||||||
if (rc != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure binary mode for reliable operation
|
|
||||||
dcb.fBinary = 1;
|
|
||||||
|
|
||||||
// Ensure comm ID matches our open port
|
|
||||||
dcb.Id = (BYTE)commId;
|
|
||||||
|
|
||||||
rc = SetCommState(&dcb);
|
|
||||||
if (rc != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// serialEnableNotify - Enable WM_COMMNOTIFY messages
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
BOOL serialEnableNotify(int16_t commId, HWND hwnd, int16_t rxThreshold, int16_t txThreshold)
|
|
||||||
{
|
|
||||||
// Enable event mask for modem status line changes, errors, and breaks
|
|
||||||
SetCommEventMask(commId, EV_CTS | EV_DSR | EV_RLSD | EV_RING | EV_ERR | EV_BREAK | EV_RXCHAR);
|
|
||||||
|
|
||||||
return EnableCommNotification(commId, hwnd, rxThreshold, txThreshold);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// serialEscape - Execute escape function (DTR, RTS, break control)
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
int16_t serialEscape(int16_t commId, int16_t func)
|
|
||||||
{
|
|
||||||
LONG rc;
|
|
||||||
|
|
||||||
rc = EscapeCommFunction(commId, func);
|
|
||||||
return (rc == 0) ? 0 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// serialFlush - Flush receive or transmit buffer
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
int16_t serialFlush(int16_t commId, int16_t queue)
|
|
||||||
{
|
|
||||||
return (int16_t)FlushComm(commId, queue);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// serialGetEventMask - Get and clear event mask bits
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
UINT serialGetEventMask(int16_t commId, UINT mask)
|
|
||||||
{
|
|
||||||
return GetCommEventMask(commId, mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// serialGetStatus - Get error status and buffer counts
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
int16_t serialGetStatus(int16_t commId, COMSTAT FAR *stat)
|
|
||||||
{
|
|
||||||
return (int16_t)GetCommError(commId, stat);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// serialOpen - Open a COM port with specified buffer sizes
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
int16_t serialOpen(int16_t port, int16_t inBufSize, int16_t outBufSize)
|
|
||||||
{
|
|
||||||
char name[8];
|
|
||||||
int commId;
|
|
||||||
|
|
||||||
wsprintf(name, "COM%d", (int)port);
|
|
||||||
commId = OpenComm(name, (UINT)inBufSize, (UINT)outBufSize);
|
|
||||||
|
|
||||||
return (int16_t)commId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// serialRead - Read data from receive buffer
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
int16_t serialRead(int16_t commId, char FAR *buf, int16_t len)
|
|
||||||
{
|
|
||||||
return (int16_t)ReadComm(commId, (LPSTR)buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// serialSetHandshaking - Apply handshaking mode
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
int16_t serialSetHandshaking(int16_t commId, int16_t mode)
|
|
||||||
{
|
|
||||||
DCB dcb;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
rc = GetCommState(commId, &dcb);
|
|
||||||
if (rc != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear all flow control settings
|
|
||||||
dcb.fOutxCtsFlow = 0;
|
|
||||||
dcb.fOutxDsrFlow = 0;
|
|
||||||
dcb.fOutX = 0;
|
|
||||||
dcb.fInX = 0;
|
|
||||||
dcb.fRtsDisable = 0;
|
|
||||||
dcb.fRtsflow = 0;
|
|
||||||
|
|
||||||
switch (mode) {
|
|
||||||
case HANDSHAKE_XONXOFF:
|
|
||||||
dcb.fOutX = 1;
|
|
||||||
dcb.fInX = 1;
|
|
||||||
dcb.XonChar = 0x11; // Ctrl-Q
|
|
||||||
dcb.XoffChar = 0x13; // Ctrl-S
|
|
||||||
dcb.XonLim = 256;
|
|
||||||
dcb.XoffLim = 256;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HANDSHAKE_RTSCTS:
|
|
||||||
dcb.fOutxCtsFlow = 1;
|
|
||||||
dcb.fRtsflow = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HANDSHAKE_BOTH:
|
|
||||||
dcb.fOutxCtsFlow = 1;
|
|
||||||
dcb.fRtsflow = 1;
|
|
||||||
dcb.fOutX = 1;
|
|
||||||
dcb.fInX = 1;
|
|
||||||
dcb.XonChar = 0x11;
|
|
||||||
dcb.XoffChar = 0x13;
|
|
||||||
dcb.XonLim = 256;
|
|
||||||
dcb.XoffLim = 256;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HANDSHAKE_NONE:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
dcb.Id = (BYTE)commId;
|
|
||||||
rc = SetCommState(&dcb);
|
|
||||||
if (rc != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// serialSetOptions - Apply null-discard and parity-replace settings
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
int16_t serialSetOptions(int16_t commId, BOOL nullDiscard, const char FAR *parityReplace)
|
|
||||||
{
|
|
||||||
DCB dcb;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
rc = GetCommState(commId, &dcb);
|
|
||||||
if (rc != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
dcb.fNull = nullDiscard ? 1 : 0;
|
|
||||||
|
|
||||||
if (parityReplace != NULL && parityReplace[0] != '\0') {
|
|
||||||
dcb.fParity = 1;
|
|
||||||
dcb.PeChar = parityReplace[0];
|
|
||||||
} else {
|
|
||||||
dcb.fParity = 0;
|
|
||||||
dcb.PeChar = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
dcb.Id = (BYTE)commId;
|
|
||||||
rc = SetCommState(&dcb);
|
|
||||||
if (rc != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// serialWrite - Write data to transmit buffer
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
int16_t serialWrite(int16_t commId, const char FAR *buf, int16_t len)
|
|
||||||
{
|
|
||||||
return (int16_t)WriteComm(commId, (LPSTR)buf, len);
|
|
||||||
}
|
|
||||||
110
vbx/serial.h
110
vbx/serial.h
|
|
@ -1,110 +0,0 @@
|
||||||
// serial.h - Serial port abstraction header
|
|
||||||
//
|
|
||||||
// Wraps Windows 3.1 comm API (OpenComm, ReadComm, WriteComm, etc.)
|
|
||||||
// for use by the MSComm VBX control.
|
|
||||||
|
|
||||||
#ifndef SERIAL_H
|
|
||||||
#define SERIAL_H
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// stdint types for MSVC 1.52 (no stdint.h available)
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#ifndef _STDINT_DEFINED
|
|
||||||
typedef short int16_t;
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
typedef long int32_t;
|
|
||||||
typedef unsigned long uint32_t;
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
typedef signed char int8_t;
|
|
||||||
#define _STDINT_DEFINED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Handshaking modes
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define HANDSHAKE_NONE 0
|
|
||||||
#define HANDSHAKE_XONXOFF 1
|
|
||||||
#define HANDSHAKE_RTSCTS 2
|
|
||||||
#define HANDSHAKE_BOTH 3
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Flush queue selectors
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define FLUSH_RX 0
|
|
||||||
#define FLUSH_TX 1
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Escape function constants (mirrors EscapeCommFunction values)
|
|
||||||
//
|
|
||||||
// SETDTR through RESETDEV are defined by windows.h.
|
|
||||||
// SETBREAK/CLRBREAK are not in windows.h (SetCommBreak/ClearCommBreak
|
|
||||||
// are separate API functions), so we define numeric values directly.
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define SERIAL_SETDTR SETDTR
|
|
||||||
#define SERIAL_CLRDTR CLRDTR
|
|
||||||
#define SERIAL_SETRTS SETRTS
|
|
||||||
#define SERIAL_CLRRTS CLRRTS
|
|
||||||
#define SERIAL_SETBREAK 8
|
|
||||||
#define SERIAL_CLRBREAK 9
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Function prototypes
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Open a COM port with specified buffer sizes.
|
|
||||||
// Returns comm ID (>= 0) on success, negative on error.
|
|
||||||
int16_t serialOpen(int16_t port, int16_t inBufSize, int16_t outBufSize);
|
|
||||||
|
|
||||||
// Close an open comm port. Drops DTR and RTS before closing.
|
|
||||||
// Returns 0 on success, negative on error.
|
|
||||||
int16_t serialClose(int16_t commId);
|
|
||||||
|
|
||||||
// Configure baud, parity, data bits, stop bits from a settings string.
|
|
||||||
// settings format: "baud,parity,data,stop" (e.g., "9600,N,8,1")
|
|
||||||
// Returns 0 on success, negative on error.
|
|
||||||
int16_t serialConfigure(int16_t commId, int16_t port, const char FAR *settings);
|
|
||||||
|
|
||||||
// Apply handshaking mode to an open port.
|
|
||||||
// mode: HANDSHAKE_NONE, HANDSHAKE_XONXOFF, HANDSHAKE_RTSCTS, HANDSHAKE_BOTH
|
|
||||||
// Returns 0 on success, negative on error.
|
|
||||||
int16_t serialSetHandshaking(int16_t commId, int16_t mode);
|
|
||||||
|
|
||||||
// Apply null-discard and parity-replace settings to an open port.
|
|
||||||
// Returns 0 on success, negative on error.
|
|
||||||
int16_t serialSetOptions(int16_t commId, BOOL nullDiscard, const char FAR *parityReplace);
|
|
||||||
|
|
||||||
// Read data from receive buffer.
|
|
||||||
// Returns number of bytes read, or negative on error.
|
|
||||||
int16_t serialRead(int16_t commId, char FAR *buf, int16_t len);
|
|
||||||
|
|
||||||
// Write data to transmit buffer.
|
|
||||||
// Returns number of bytes written, or negative on error.
|
|
||||||
int16_t serialWrite(int16_t commId, const char FAR *buf, int16_t len);
|
|
||||||
|
|
||||||
// Get comm error status and buffer counts. Clears the error state.
|
|
||||||
// Returns error flags, fills stat with buffer counts.
|
|
||||||
int16_t serialGetStatus(int16_t commId, COMSTAT FAR *stat);
|
|
||||||
|
|
||||||
// Execute an escape function (DTR, RTS, break control).
|
|
||||||
// func: SERIAL_SETDTR, SERIAL_CLRDTR, SERIAL_SETRTS, etc.
|
|
||||||
// Returns 0 on success, negative on error.
|
|
||||||
int16_t serialEscape(int16_t commId, int16_t func);
|
|
||||||
|
|
||||||
// Get modem status lines via GetCommEventMask.
|
|
||||||
// Returns event mask bits (EV_CTS, EV_DSR, EV_RLSD, EV_RING).
|
|
||||||
UINT serialGetEventMask(int16_t commId, UINT mask);
|
|
||||||
|
|
||||||
// Enable WM_COMMNOTIFY messages to the specified window.
|
|
||||||
// rxThreshold: fire CN_RECEIVE when this many bytes available (-1=disable)
|
|
||||||
// txThreshold: fire CN_TRANSMIT when this much space free (-1=disable)
|
|
||||||
// Returns TRUE on success.
|
|
||||||
BOOL serialEnableNotify(int16_t commId, HWND hwnd, int16_t rxThreshold, int16_t txThreshold);
|
|
||||||
|
|
||||||
// Flush receive and/or transmit buffers.
|
|
||||||
// queue: FLUSH_RX or FLUSH_TX
|
|
||||||
// Returns 0 on success, negative on error.
|
|
||||||
int16_t serialFlush(int16_t commId, int16_t queue);
|
|
||||||
|
|
||||||
#endif // SERIAL_H
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
; vbapi.def - VB API import library definition
|
|
||||||
;
|
|
||||||
; Defines the VB API functions exported by the VBAPI module.
|
|
||||||
; Use with IMPLIB to generate the import library:
|
|
||||||
;
|
|
||||||
; implib vbapi.lib vbapi.def
|
|
||||||
;
|
|
||||||
; The VBAPI module is the VB runtime that exports these functions.
|
|
||||||
; When VB loads a VBX, it resolves imports against this module.
|
|
||||||
|
|
||||||
LIBRARY VBAPI
|
|
||||||
|
|
||||||
EXPORTS
|
|
||||||
VBRegisterModel @100
|
|
||||||
VBDefControlProc @101
|
|
||||||
VBFireEvent @102
|
|
||||||
VBCreateHsz @103
|
|
||||||
VBDestroyHsz @104
|
|
||||||
VBDerefHsz @105
|
|
||||||
VBCreateHlstr @106
|
|
||||||
VBDestroyHlstr @107
|
|
||||||
VBGetHlstr @108
|
|
||||||
VBSetHlstr @109
|
|
||||||
VBDerefControl @110
|
|
||||||
VBGetMode @111
|
|
||||||
VBSetControlProperty @112
|
|
||||||
VBGetControlProperty @113
|
|
||||||
VBGetControlHwnd @114
|
|
||||||
VBGetHInstance @115
|
|
||||||
290
vbx/vbapi.h
290
vbx/vbapi.h
|
|
@ -1,290 +0,0 @@
|
||||||
// vbapi.h - Reconstructed VBX CDK header
|
|
||||||
//
|
|
||||||
// Reconstructed from the published Visual Basic Custom Control (VBX)
|
|
||||||
// specification for use with MSVC 1.52 targeting 16-bit Visual Basic 4.
|
|
||||||
// Types, structures, constants, and API prototypes match the VBX CDK.
|
|
||||||
|
|
||||||
#ifndef VBAPI_H
|
|
||||||
#define VBAPI_H
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Packing: VBX CDK structures use byte packing
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#pragma pack(1)
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Core types
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#ifndef USHORT
|
|
||||||
typedef unsigned short USHORT;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef LPVOID HCTL; // Handle to a VBX control instance
|
|
||||||
typedef LPSTR HSZ; // Handle to a VB-managed string
|
|
||||||
typedef LPVOID HLSTR; // Handle to a VB long string
|
|
||||||
typedef USHORT ERR; // Error code
|
|
||||||
|
|
||||||
// Flag type
|
|
||||||
typedef DWORD FL;
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Forward declarations and pointer types
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
typedef struct tagMODEL MODEL;
|
|
||||||
typedef struct tagPROPINFO PROPINFO;
|
|
||||||
typedef struct tagEVENTINFO EVENTINFO;
|
|
||||||
|
|
||||||
typedef MODEL FAR *LPMODEL;
|
|
||||||
typedef PROPINFO *PPROPINFO; // Near pointer (DLL data segment)
|
|
||||||
typedef EVENTINFO *PEVENTINFO; // Near pointer (DLL data segment)
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Control procedure type
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
typedef LONG (FAR PASCAL *PCTLPROC)(HCTL, HWND, USHORT, USHORT, LONG);
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// VB version constants
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define VB_VERSION 0x0300
|
|
||||||
#define VB300_VERSION 0x0300
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Data types (bits 0-7 of PROPINFO.fl)
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define DT_HSZ 0x01
|
|
||||||
#define DT_SHORT 0x02
|
|
||||||
#define DT_LONG 0x03
|
|
||||||
#define DT_BOOL 0x04
|
|
||||||
#define DT_COLOR 0x05
|
|
||||||
#define DT_ENUM 0x06
|
|
||||||
#define DT_REAL 0x07
|
|
||||||
#define DT_XPOS 0x08
|
|
||||||
#define DT_XSIZE 0x09
|
|
||||||
#define DT_YPOS 0x0A
|
|
||||||
#define DT_YSIZE 0x0B
|
|
||||||
#define DT_PICTURE 0x0C
|
|
||||||
#define DT_HLSTR 0x0D
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Property flags (bits 8+ of PROPINFO.fl)
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define PF_datatype 0x000000FFL // Mask for data type field
|
|
||||||
#define PF_fPropArray 0x00000100L
|
|
||||||
#define PF_fSetData 0x00000200L
|
|
||||||
#define PF_fSetMsg 0x00000400L
|
|
||||||
#define PF_fNoShow 0x00000800L
|
|
||||||
#define PF_fNoRuntimeW 0x00001000L
|
|
||||||
#define PF_fGetData 0x00002000L
|
|
||||||
#define PF_fGetMsg 0x00004000L
|
|
||||||
#define PF_fSetCheck 0x00008000L
|
|
||||||
#define PF_fSaveData 0x00010000L
|
|
||||||
#define PF_fSaveMsg 0x00020000L
|
|
||||||
#define PF_fGetHszMsg 0x00040000L
|
|
||||||
#define PF_fUpdateOnEdit 0x00080000L
|
|
||||||
#define PF_fEditable 0x00100000L
|
|
||||||
#define PF_fPreHwnd 0x00200000L
|
|
||||||
#define PF_fDefVal 0x00400000L
|
|
||||||
#define PF_fNoInitDef 0x00800000L
|
|
||||||
#define PF_fNoRuntimeR 0x02000000L
|
|
||||||
#define PF_fNoMultiSelect 0x04000000L
|
|
||||||
#define PF_fLoadDataOnly 0x20010000L
|
|
||||||
#define PF_fLoadMsgOnly 0x20020000L
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// MODEL flags
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define MODEL_fArrows 0x00000001L
|
|
||||||
#define MODEL_fFocusOk 0x00000002L
|
|
||||||
#define MODEL_fMnemonic 0x00000004L
|
|
||||||
#define MODEL_fChildrenOk 0x00000008L
|
|
||||||
#define MODEL_fInitMsg 0x00000010L
|
|
||||||
#define MODEL_fLoadMsg 0x00000020L
|
|
||||||
#define MODEL_fDesInteract 0x00000040L
|
|
||||||
#define MODEL_fInvisAtRun 0x00000080L
|
|
||||||
#define MODEL_fGraphical 0x00000100L
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// VBX control messages
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define VBM__BASE (WM_USER + 0x0C00)
|
|
||||||
#define VBM_CREATED (VBM__BASE + 0x00)
|
|
||||||
#define VBM_LOADED (VBM__BASE + 0x01)
|
|
||||||
#define VBM_INITIALIZE (VBM__BASE + 0x02)
|
|
||||||
#define VBM_GETPROPERTY (VBM__BASE + 0x03)
|
|
||||||
#define VBM_CHECKPROPERTY (VBM__BASE + 0x04)
|
|
||||||
#define VBM_SETPROPERTY (VBM__BASE + 0x05)
|
|
||||||
#define VBM_SAVEPROPERTY (VBM__BASE + 0x06)
|
|
||||||
#define VBM_LOADPROPERTY (VBM__BASE + 0x07)
|
|
||||||
#define VBM_MNEMONIC (VBM__BASE + 0x0D)
|
|
||||||
#define VBM_METHOD (VBM__BASE + 0x11)
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Error codes
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define ERR_None 0
|
|
||||||
#define ERR_InvPropVal 380 // Invalid property value
|
|
||||||
#define ERR_InvPropSet 383 // Can't set property at this time
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Standard property indices
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define IPROP_STD_NAME 0x0000
|
|
||||||
#define IPROP_STD_CTLNAME IPROP_STD_NAME
|
|
||||||
#define IPROP_STD_INDEX 0x0001
|
|
||||||
#define IPROP_STD_HWND 0x0002
|
|
||||||
#define IPROP_STD_BACKCOLOR 0x0003
|
|
||||||
#define IPROP_STD_FORECOLOR 0x0004
|
|
||||||
#define IPROP_STD_LEFT 0x0005
|
|
||||||
#define IPROP_STD_TOP 0x0006
|
|
||||||
#define IPROP_STD_WIDTH 0x0007
|
|
||||||
#define IPROP_STD_HEIGHT 0x0008
|
|
||||||
#define IPROP_STD_ENABLED 0x0009
|
|
||||||
#define IPROP_STD_VISIBLE 0x000A
|
|
||||||
#define IPROP_STD_PARENT 0x0014
|
|
||||||
#define IPROP_STD_DRAGMODE 0x0015
|
|
||||||
#define IPROP_STD_DRAGICON 0x0016
|
|
||||||
#define IPROP_STD_TAG 0x0019
|
|
||||||
#define IPROP_STD_NONE 0x001E
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Standard property pointers
|
|
||||||
//
|
|
||||||
// Magic sentinel values recognized by VB as built-in properties.
|
|
||||||
// Uses bitwise NOT of standard property index.
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define PPROPINFO_STD_NAME ((PPROPINFO)~IPROP_STD_NAME)
|
|
||||||
#define PPROPINFO_STD_CTLNAME ((PPROPINFO)~IPROP_STD_CTLNAME)
|
|
||||||
#define PPROPINFO_STD_INDEX ((PPROPINFO)~IPROP_STD_INDEX)
|
|
||||||
#define PPROPINFO_STD_HWND ((PPROPINFO)~IPROP_STD_HWND)
|
|
||||||
#define PPROPINFO_STD_LEFT ((PPROPINFO)~IPROP_STD_LEFT)
|
|
||||||
#define PPROPINFO_STD_TOP ((PPROPINFO)~IPROP_STD_TOP)
|
|
||||||
#define PPROPINFO_STD_WIDTH ((PPROPINFO)~IPROP_STD_WIDTH)
|
|
||||||
#define PPROPINFO_STD_HEIGHT ((PPROPINFO)~IPROP_STD_HEIGHT)
|
|
||||||
#define PPROPINFO_STD_ENABLED ((PPROPINFO)~IPROP_STD_ENABLED)
|
|
||||||
#define PPROPINFO_STD_VISIBLE ((PPROPINFO)~IPROP_STD_VISIBLE)
|
|
||||||
#define PPROPINFO_STD_PARENT ((PPROPINFO)~IPROP_STD_PARENT)
|
|
||||||
#define PPROPINFO_STD_DRAGMODE ((PPROPINFO)~IPROP_STD_DRAGMODE)
|
|
||||||
#define PPROPINFO_STD_DRAGICON ((PPROPINFO)~IPROP_STD_DRAGICON)
|
|
||||||
#define PPROPINFO_STD_TAG ((PPROPINFO)~IPROP_STD_TAG)
|
|
||||||
#define PPROPINFO_STD_NONE ((PPROPINFO)~IPROP_STD_NONE)
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// PROPINFO - Property descriptor
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
struct tagPROPINFO {
|
|
||||||
PSTR npszName; // Property name (near pointer, DLL DS)
|
|
||||||
FL fl; // Data type (bits 0-7) | Property flags (bits 8+)
|
|
||||||
BYTE offsetData; // Byte offset in control's cbCtlExtra data
|
|
||||||
BYTE infoData; // Type-specific info (e.g., max string length)
|
|
||||||
LONG dataDefault; // Default value
|
|
||||||
PSTR npszEnumList; // DT_ENUM: null-separated, double-null terminated
|
|
||||||
BYTE enumMax; // DT_ENUM: maximum valid value
|
|
||||||
};
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// EVENTINFO - Event descriptor
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
struct tagEVENTINFO {
|
|
||||||
PSTR npszName; // Event name
|
|
||||||
USHORT cParms; // Number of parameters
|
|
||||||
USHORT cwParms; // Size of parameters in words
|
|
||||||
PWORD npParmTypes; // Parameter type list (NULL if no params)
|
|
||||||
PSTR npszParmProf; // Parameter profile string (e.g., "value As Integer")
|
|
||||||
FL fl; // Event flags
|
|
||||||
};
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// MODEL - Control model definition
|
|
||||||
//
|
|
||||||
// VB3+ version (usVersion = VB300_VERSION) for VB4 compatibility.
|
|
||||||
// Registered with VBRegisterModel() in VBINITCC.
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
struct tagMODEL {
|
|
||||||
USHORT usVersion; // VB_VERSION (0x0300)
|
|
||||||
FL fl; // MODEL_* flags
|
|
||||||
PCTLPROC pctlproc; // Control procedure
|
|
||||||
USHORT fsClassStyle; // Window class style bits
|
|
||||||
FL flWndStyle; // Window style bits
|
|
||||||
USHORT cbCtlExtra; // Bytes of per-instance data
|
|
||||||
USHORT idBmpPalette; // Toolbox bitmap resource ID
|
|
||||||
PSTR npszDefCtlName; // Default control name (near)
|
|
||||||
PSTR npszClassName; // Window class name (NULL = default)
|
|
||||||
PSTR npszParentClassName; // Parent class name (NULL = default)
|
|
||||||
PPROPINFO *npproplist; // Property list (NULL-terminated array)
|
|
||||||
PEVENTINFO *npeventlist; // Event list (NULL-terminated array)
|
|
||||||
BYTE nDefProp; // Default property index
|
|
||||||
BYTE nDefEvent; // Default event index
|
|
||||||
BYTE nValueProp; // Value property index
|
|
||||||
USHORT usCtlVersion; // Control version (BCD, user-defined)
|
|
||||||
};
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// MODELINFO - Returned by VBGetModelInfo (VB4+ model discovery)
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
typedef struct tagMODELINFO {
|
|
||||||
USHORT usVersion; // VB_VERSION
|
|
||||||
LPMODEL FAR *lplpmodel; // Null-terminated list of LPMODEL
|
|
||||||
} MODELINFO;
|
|
||||||
|
|
||||||
typedef MODELINFO FAR *LPMODELINFO;
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Utility macro: byte offset of a field within a structure
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#define OFFSETIN(type, field) ((BYTE)&(((type *)0)->field))
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// VB API function prototypes
|
|
||||||
//
|
|
||||||
// These functions are exported by the VB runtime (VBAPI module) and
|
|
||||||
// resolved at load time when VB loads the VBX.
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Control registration
|
|
||||||
BOOL FAR PASCAL VBRegisterModel(HANDLE hmodule, MODEL FAR *lpmodel);
|
|
||||||
|
|
||||||
// Default control procedure
|
|
||||||
LONG FAR PASCAL VBDefControlProc(HCTL hctl, HWND hwnd, USHORT msg, USHORT wp, LONG lp);
|
|
||||||
|
|
||||||
// Event firing
|
|
||||||
ERR FAR PASCAL VBFireEvent(HCTL hctl, USHORT iEvent, LPVOID lpparams);
|
|
||||||
|
|
||||||
// String handle management
|
|
||||||
HSZ FAR PASCAL VBCreateHsz(HANDLE seg, LPSTR lpsz);
|
|
||||||
HSZ FAR PASCAL VBDestroyHsz(HSZ hsz);
|
|
||||||
LPSTR FAR PASCAL VBDerefHsz(HSZ hsz);
|
|
||||||
|
|
||||||
// Long string handle management
|
|
||||||
HLSTR FAR PASCAL VBCreateHlstr(LPVOID lpdata, USHORT cbLen);
|
|
||||||
void FAR PASCAL VBDestroyHlstr(HLSTR hlstr);
|
|
||||||
USHORT FAR PASCAL VBGetHlstr(HLSTR hlstr, LPVOID pb, USHORT cbLen);
|
|
||||||
ERR FAR PASCAL VBSetHlstr(HLSTR FAR *phlstr, LPVOID lpdata, USHORT cbLen);
|
|
||||||
|
|
||||||
// Control data access
|
|
||||||
LPVOID FAR PASCAL VBDerefControl(HCTL hctl);
|
|
||||||
|
|
||||||
// Runtime mode query (MODE_DESIGN=1, MODE_RUN=2, MODE_BREAK=3)
|
|
||||||
USHORT FAR PASCAL VBGetMode(void);
|
|
||||||
|
|
||||||
// Control property access
|
|
||||||
ERR FAR PASCAL VBSetControlProperty(HCTL hctl, USHORT iProp, LONG data);
|
|
||||||
ERR FAR PASCAL VBGetControlProperty(HCTL hctl, USHORT iProp, LPVOID pdata);
|
|
||||||
|
|
||||||
// Control window handle
|
|
||||||
HWND FAR PASCAL VBGetControlHwnd(HCTL hctl);
|
|
||||||
|
|
||||||
// Instance handle
|
|
||||||
HANDLE FAR PASCAL VBGetHInstance(void);
|
|
||||||
|
|
||||||
// Runtime version
|
|
||||||
USHORT FAR PASCAL VBGetVersion(void);
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// Restore default packing
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#pragma pack()
|
|
||||||
|
|
||||||
#endif // VBAPI_H
|
|
||||||
Loading…
Add table
Reference in a new issue