0

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

Luca Romagnoli
  • 12,145
  • 30
  • 95
  • 157
  • I think you'll have to compile those files within a DLL then load it as such. I don't think there are Win32 APIs functions to handle .res files directly. – Francis Ducharme Mar 12 '15 at 19:21
  • 1
    You can add a reference to the Visual Basic 6 Resource Editor. It can load a file using the ParseResFile method. You'll have to experiment with how to get the strings from the m_STRINGS collection though. I don't know how to do that. – jac Mar 12 '15 at 22:16

1 Answers1

1

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.

Serenity
  • 31
  • 2