Skip to content

Instantly share code, notes, and snippets.

#include <windows.h>
#include <oleauto.h>
#include <conio.h>
#include <stdio.h>
#pragma comment(lib,"OleAut32.lib")
/*
This is an example of testing OleAut32.DispCallFunc from C with a VB6 ActiveX object.
@dzzie
dzzie / main.bas
Created January 1, 2023 14:06
vb6 bulk compile
'bulk compile all vb6 project files in and below target directory
'requires a reference to vbdevkit library: http://sandsprite.com/tools.php?id=3
Sub Main()
On Error Resume Next
Dim exe As String, f() As String, ff, b
Dim fso As New CFileSystem2, c As New CCmdOutput
exe = "C:\Program Files (x86)\Microsoft Visual Studio\VB98\vb6.exe"
'output:
' main
' VBAutomation
'
' imm
' OleDropTargetInterface
' OleEndPointID
' VBAutomation
Declare Function lstrlenA Lib "kernel32" (lpString As Any) As Long
@dzzie
dzzie / ClearImmediateWindow.bas
Created September 10, 2022 21:25
ClearImmediateWindow
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWndParent As Long, ByVal hWndChildAfter As Long, ByVal lpszClass As String, ByVal lpszWindow As String) As Long
Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Const KEYEVENTF_KEYUP = &H2
Public Const VK_CANCEL = &H3
Public Const VK_CONTROL = &H11
Public Const WM_ACTIVATE As Long = &H6
Public Sub ClearImmediateWindow()
Private Sub Form_Load()
Dim t As t1 'defined as public UDT in an activex dll
t.aaaaa = 21
t.bbbbb = "test"
t.ccccc = "blahblah"
Debug.Print UDTMemberGetValue(t, "bbbbb")
End Sub
@dzzie
dzzie / test.bas
Last active March 18, 2022 00:19
txtTable
Option Explicit
Private Sub Form_Load()
Dim test As String
test = String(20, "A") & " 111 222" & vbCrLf & _
String(40, "B") & " 333 444" & vbCrLf & _
String(5, "C") & " 555 666" & vbCrLf
Debug.Print txtTable(test, " ", 3, , Me)
'save this file as enumSerialPorts.vbs
'open a command shell,
'change directory to the same folder the vbs script is in (cd command)
'type in: cscript enumSerialPorts.vbs
'if WMI is working it should print out any connected COM port devices like arduinos.
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_SerialPort", , 48)
'copies all the data from a flexgrid into well formatted rows for text display
'use delimiter to skip padding and have in csv type format,
'delimiter not checked for in data
Public Sub FlexGridCopy(fg As msflexgrid, Optional delimiter = Empty)
Dim colWidths() As Long
ReDim colWidths(fg.Cols)
Dim rows() As String
Dim fields() As String
Dim d As String
@dzzie
dzzie / WindowsMessage.cs
Created May 26, 2018 12:05 — forked from amgine/WindowsMessage.cs
All windows messages as C# enum
namespace NAMESPACE
{
public enum WindowsMessage
{
WM_NULL = 0x0000,
WM_CREATE = 0x0001,
WM_DESTROY = 0x0002,
WM_MOVE = 0x0003,
WM_SIZE = 0x0005,
WM_ACTIVATE = 0x0006,
@dzzie
dzzie / gist:4a040e6b1a39aa064e42d6736250492a
Last active July 29, 2016 15:55
IDA extract pointer address and value from disasm vb6
vb6 parser:
------------------------------------------
tmp = Split(Text1, vbCrLf)
Dim x, r()
For Each x In tmp
'.Upack:100082E0 dword_100082E0 dd 77DDEFB8h ; DATA XREF: ToExtractEmail+15r
a = InStr(x, "dword_")