Domanda

I have text file in VB6 Application resources, and I am trying to read the text in it.

How to do that? I have been searching for hours without a proper solution. Somebody please help me.

My code is:

Private Sub Command1_Click()
Dim URL As String
URL = LoadResString(101)
MsgBox URL
End Sub

This maybe explains it more: http://i.imgur.com/wGnWCBb.jpg

Is this even possible? Somebody please spoonfeed me, I would appreciate that a lot.

I am trying to read the string from resource to a variable(string) and then prompt it with messagebox.

Some simple solution would be great. Also, if this is possible with FindResource API, please tell me how or point me to the right direction.

È stato utile?

Soluzione

I had to do something like this many years ago.

I used s = StrConv(LoadResData(resId, resType), vbUnicode). The resource was an ANSI (non-unicode) file.

resType was a custom type I just made up when I saved the resource.

I had an issue with a double null that got appended at the end of the text, and which had to be removed. I can't remember the exact reason why that happens, but I presume it has to do with the resource being stored as a double-null-terminated list of C-strings.

Altri suggerimenti

If I had to guess, you'll have better luck with LoadResData(). Make sure to use both parameters (the id and type ones).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top