Extract strings from .res

396 Views Asked by At

i have many vb6 project with .res file with some strings in it. I have to create another vb6 project for extract them.

i tried to use

hModule = LoadLibraryEx("c:\project\CGUO_SPESOMETRO.Res", _
                            0&, LOAD_LIBRARY_AS_DATAFILE)

But it doesn't work because LoadLibraryEx load only .dll file

How can i do?

Thanks

1

There are 1 best solutions below

0
Serenity On

This extracts a text file/string from a resource embedded in an exe (it makes a menu from a text file).

Note VB can't make this type of resource. I use ResHacker to add the resource to a VB made Res file.

Private Sub mnuInsertCharacterMenu_Click(Index As Integer)
    Dim MenuItems() As String
    Dim MenuItem() As String
    Dim Characters() As String
    Dim Temp As String
    Dim Table() As Byte
    Dim X As Long
    Table() = LoadResData(102, 10)
    Temp = StrConv(Table(), vbUnicode)
    Temp = Replace(Temp, vbLf, "")
    MenuItems() = Split(Temp, vbCr)
    MenuItem = Split(MenuItems(Index), vbTab)
    Characters() = Split(MenuItem(1), Chr(44))
    For X = LBound(Characters()) To UBound(Characters())
        If Val(Characters(X)) > 255 Then
            MsgBox "Sorry no unicode this version. It included as this is test software and as far as possible it uses the unicode version's source files."
                Else
            txtNote.SelText = Chr(Val(Characters(X)))
        End If
    Next
End Sub

PS: As to your res file, add to a new VB project, and a blank module with Sub Main, and compile as a DLL.