GrfOpenCallback non è una struttura ma un puntatore a funzione. In VB.NET devi scriverlo come un delegato; la definizione della struttura è in molti punti errata, come evidenziato di seguito:
.codice:Public Structure Grf Dim filename As String Dim len As Integer Dim type As Integer Dim version As Integer Dim nfiles As Integer Dim files() As GrfFile 'Su questo non sarei così sicuro... Dim first As GrfFile 'Questo (e quello che segue) è un PUNTATORE a GrfFile, non una struttura GrfFile Dim last As GrfFile Dim allowCrypt As Int16 'Questo dovrebbe essere un intero a 8 bit senza segno; questo tipo di dati non esiste in .NET Dim f As System.IO.File 'Non puoi usare uno stream .NET al posto di un puntatore a FILE! Dim allowWrite As Int16 'Vale lo stesso discorso fatto per allowCrypt Dim zbuf As Object 'Come già detto dovrebbe essere un IntPtr End Structure
Inoltre la funzione non restituisce una struttura Grf, ma un puntatore ad essa.