VBMAN - A Modern Network Development Framework for VB6/VBA (Open Source)
Hey, ervrybudy, visualbasic!
I'm excited to share that I've just open-sourced **VBMAN**, a network application development framework I've been working on since 2017. It's designed specifically for VB6 and VBA developers who need modern networking capabilities.
## What is VBMAN?
VBMAN is a comprehensive network development framework that brings modern web technologies to the BASIC ecosystem. If you've ever struggled with making HTTP requests, hosting a web server, or handling WebSockets in VB6/VBA, this might save you some headaches.
## Key Features
### Web Development
- **HTTP Server** - Build lightweight web services directly in VB6/VBA
- **HTTP Client** - Modern HTTP/HTTPS requests with JSON support
- **WebSocket** - Real-time bidirectional communication
- **Server-Sent Events (SSE)** - Server-to-client streaming
- **JSON Processing** - Native JSON serialization/deserialization
### Database & Storage
- **Database Access** - Simplified SQL operations
- **Redis Client** - Cache and message broker support
- **INI File Handler** - Structured configuration management
### Industrial IoT Protocols
- **Modbus TCP/RTU** - Master and Slave implementations
- **MQTT Client/Server** - Lightweight messaging for IoT
- **Serial Port** - Direct hardware communication
### Utilities
- **Shadow Window** - Modern UI effects for VB6 forms
- **Collection Tools** - Enhanced data structures
- **Cryptography** - AES, Hash, HMAC support
- **Logging System** - Structured application logging
## Why VBMAN?
I started this project in 2017 because I needed to build network applications for industrial automation, but VB6's built-in networking capabilities were... limited. Rather than migrate everything to .NET, I decided to extend VB6's capabilities.
The framework is designed to feel native to VB6 developers - the API style follows familiar patterns, so you don't need to learn a completely new way of thinking.
## VBMAN2 - The Next Generation
I'm also working on **VBMAN2**, which **includes all VBMAN capabilities** and adds WebView2 support with two-way data binding. This means you can build modern web-based UIs that communicate seamlessly with your VB6/VBA code:
> **Note**: VBMAN2 is a superset of VBMAN - everything in VBMAN works in VBMAN2, plus more. You can seamlessly upgrade when you're ready.
```vb
' Bind UI elements to VB6 code
wv.BindData "username", "#user-name", "textContent"
wv.SetData "username", "John" ' UI updates automatically
' Two-way binding
wv.BindUI Me, "OnSearch", "#search-input", EventName:="input"
```
## Project Info
- **License**: GPL-3.0 (Binary files are free forever, source available for personal use)
- **Documentation**: see gihub
- **Repository**: https://github.com/woeoio/vbman
## Who is this for?
- Maintaining legacy VB6/VBA applications
- Industrial automation systems
- Quick prototyping for internal tools
- Anyone who still enjoys BASIC syntax (no judgment here!)
## Questions?
Happy to answer any questions! The documentation site has detailed API references and examples. I've been using this in production environments for years, so it's battle-tested for industrial scenarios.
---
**Fun fact**: This project started as "BSMAN" (Basic Server Man) back in 2017, with grand plans for ASPMAN, VBSMAN, and VBAMAN sub-projects. Only VBMAN survived... and thrived!
Re: VBMAN - A Modern Network Development Framework for VB6/VBA (Open Source)
---
url: /en/vbman/demo/1.HelloWorld.md
---
# VBMAN HelloWorld Example
## Overview
This is an example of creating a basic web server using the VBMAN library, demonstrating the simplest HTTP server setup and route configuration.
## Project Structure
::: tip Download source \[ Note?To `bin` regedits DLL file ]
Please go to the home page to download the VBMAN project, decompress it, and open it with all DEMO projects.
:::
```
Code:
Helloworld/
|-- Form1.frm # Main form, contains server startup code
|-- bHello.cls # Hello business class, handles specific requests
|-- VBMAN_DEMO.vbp # VB6 project file
```
## Core Code Analysis
### 1. Main Form (Form1.frm)
```vb
Code:
Dim HttpServer As New cHttpServer
Private Sub Form_Load()
With HttpServer
.Router.Reg "Demo", New bHello 'Register business class
.Router.AutoRoute = True 'Enable auto routing
.Start 800 'Start server, listen on port 800
End With
Shell "explorer.exe http://127.0.0.1:800/demo/hello" 'Automatically open browser to visit example
End Sub
```
### 2. Hello Business Class (bHello.cls)
```vb
Code:
Public Sub Hello(ctx As cHttpServerContext)
Dim id As Long: id = ctx.Request.QueryString("id") 'Get URL parameter id
ctx.Response.Text "hello vbman @ " & id 'Return response text
End Sub
```
## Feature Description
1. **HTTP Server Configuration**
* Create HTTP server using VBMAN library's cHttpServer class
* Server listens on port 800
* Automatically opens browser to visit example page when program starts
2. **Routing System**
* Register bHello class as Demo business handler
* Enable auto routing feature (AutoRoute = True)
* Route rule: /demo/hello maps to bHello.Hello method
* URL parameter example: /demo/hello?id=123
3. **Request Handling**
* Get URL parameters through ctx.Request.QueryString
* Return text response using ctx.Response.Text
## Technical Points
1. VBMAN handles web requests in an object-oriented way
2. Auto routing feature can automatically generate URL paths based on class and method names
3. Context object (ctx) provides complete request/response handling capabilities
## Running Effect
After startup, it will automatically open the browser to visit http://127.0.0.1:800/demo/hello, and the page will display "hello vbman @ " followed by the provided id value.
## Extension Suggestions
1. Add more business methods to handle different URL requests
2. Return different types of responses, such as JSON, HTML, etc.
3. Add more URL parameter handling logic