Visual Basic 6 · 5 / P-Code · MSVBVM60 / MSVBVM50

VB6 P-Code decompiler: the interpreter's token stream, back to Basic.

Unless a developer switched the project to native code, Visual Basic 5 and 6 compiled to P-Code: a stream of tokens that the runtime interprets at run time. That stream keeps far more of the original structure than machine code does, and our P-Code decompiler decodes it procedure by procedure into readable Basic — not a token dump — inside the same rebuilt project you get for native VB6.

See a real P-Code recovery, Miner VGA, next to its original source →

// under the hood

How P-Code programs work

A P-Code build imports only the runtime's interpreter entry points, ProcCallEngine and MethCallEngine, and keeps each procedure as a sequence of opcodes: push this value, call that method, compare, branch. The runtime executes them one at a time. Because the opcodes are the compiler's own intermediate language, they still say what the code does rather than how the processor should do it.

The decompiler runs those opcodes through a stack machine of its own, tracking operands as it goes, and emits Basic as each statement completes. Post-passes then restore the shape a programmer wrote: ElseIf cascades, Do loops, For / Next, Select Case including Case lo To hi ranges, On Error Resume Next, On Error GoTo 0 and labelled handlers, Property Get / Let / Set, Type blocks and absolute module globals. Events are matched to their controls from the control name and the event interface, so cmdOK_Click lands on the right button.

// what comes back

What the P-Code decompiler brings back

  • ✓

    Procedure-by-procedure decompilation

    Every procedure decoded to Basic, with the raw token and opcode listing available alongside for anyone who wants to verify the work.

  • ✓

    The same project rebuild as native

    Forms with controls and .frx resources, modules, classes, user controls, property pages and designers, in a .vbp that opens in VB6.

  • ✓

    Error handling and properties as written

    On Error forms, Property Get / Let / Set, user-defined types and constant substitution come back in place.

  • ✓

    Event handlers on the right controls

    All 83 event-handler names recovered on our largest P-Code benchmark, each attached to its form and control.

// measured

Measured on real P-Code programs

BenchmarkMetricThen → now
Areena5.exe (1.82 MB game)Procedures decoded496 of 496, 0 undecoded opcodes
Uncompilable Unknown GUID references97 → 0
Lost operands332 → 10
Fabricated literals120 → 0
Forms with a balanced designer7 of 7
DNManagerPro.exeModules with correct names22 of 22
Procedures recovered vs source218 of 219
On Error Resume Next restored30 of 31
Declare statements35 of 38
// the fine print

What P-Code keeps, and what it drops

More survives than in native code — but not everything

Form, control, class and event-handler names, module names and Declare signatures are kept. Standard-module procedure names are not: their name tables are empty in the EXE, so module procedures come back as Proc0040A1C0-style placeholders. Projects that use only late binding carry no Reference= data for the type libraries they touch, and a property value that equals the control's default cannot be told apart from one that was never set. Comments are never compiled.

// how to decompile your program

Three ways to get from the EXE to source

STEP 01

Confirm the format

Run the free VBScanner on the folder. It reads the file headers and tells you what built each EXE, DLL or OCX and whether it is P-Code, native or IL.

STEP 03

…or let us do it

Request a free evaluation. We examine the binary, tell you exactly what comes back, and quote a fixed price and timeline. Hand-finishing of anything the engine marks is included.

// questions

VB6 P-Code decompiler questions

How do I know whether my VB6 program is P-Code or native?

Run the free VBScanner on it. It reads the VB5! header and reports P-Code or native for every EXE, DLL and OCX in a folder. The software reports the same thing in its File Report.

Is P-Code easier to decompile than native code?

Yes. P-Code is the compiler's own intermediate language, so conditions, loops and calls decode directly; native code has to be reconstructed from machine instructions. Both engines produce the same project layout, but P-Code output usually needs less clean-up.

Are VB5 P-Code programs supported too?

Yes. VB5 and VB6 share the VB5! header and the same P-Code design; the runtime is MSVBVM50 instead of MSVBVM60. See the VB5 decompiler page for the differences.

// other formats

Every generation of Basic has its own page

Ready to decompile your VB6 P-Code program?

The evaluation is free and tells you exactly what your binary yields before you spend anything. Or license the decompiler and run it in-house today.

free evaluation fixed quotes NDA available software from $299