VB6 Callback from C#


Author: Dave
Date: 09.24.10 - 3:16pm

Did a little bit of googling on this, but all i seemed to find is info about C# callbacks and delegates.

In this sample I take a VB6 executable, call a C# COM dll, and then send execution back from the C# dll to a function within the VB6 executable as a call back.

This technique is quite useful when the called code does some kind of list building or parsing and has to send notifications back to the parent process while it is processing.

The easiest way i could think of to do this, was to use the VB6 addressof operator to pass a function address to the C# code. The CSharp code then uses the CallWindowProc API to send the notification message back to the VB6 function. And you dont even have to use /unsafe.

Even though you are limited to a specific function prototype, using Marshal.GAlloc, Marshal.Copy and CopyMemory from VB this shouldnt really be much of a limitation at all!

Download Sample



RSS Feed
About Me
Home

Posts:
C# App Config
Tero DES C# Test
VC 2008 Bit Fields
Speed trap
C# Db Class Generator
VB6 vrs .NET (again)
FireFox Whois Extension
git and vb6
Code Additions
Compiled date to string
C# ListView Sorter
VB6 Wish List
C# Process Injection
CAPTCHA Bots
C# PE Offset Calculator
VB6 Async Download
Show Desktop
Code release
Dll Not Found in IDE
Advanced MSScript Control
random tip
Clipart / Vector Art
VB6 Callback from C#
Binary data from VB6 to C#
CSharp and MsScriptControl
HexDumper functions
Js Beautify From VB
vb6 FormPos
Inline Asm w VB6
The .NET Fiasco
One rub on computers
Universal extractor


Comments: (0)

 
Leave Comment:
Name:
Email: (not shown)
Message: (Required)
Math Question: 68 + 51 = ? followed by the letter: C