|
-
May 4th, 2005, 04:41 AM
#1
Thread Starter
Hyperactive Member
String data type internat representation
Hello everybody
I was wondering what the internal encoding of a String data type is in VB6. Is it Unicode or ACSII?
Also, in my application I store strings embedded in the code. Is there a better way? Something like a string table in Visual C++ 6.0.
thx, in advance
George Papadopoulos
Last edited by divined; May 30th, 2005 at 12:57 AM.
SteadFast!
-
May 4th, 2005, 04:53 AM
#2
Frenzied Member
Re: String data type internat representation
-
May 4th, 2005, 05:04 AM
#3
Re: String data type internat representation
There isn't a direct "String Table" functionality in Visual Basic. There may be an add-in which allows it. People talk alot about MZTools, although I haven't used it before, and really don't know about it at all.
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
May 4th, 2005, 05:09 AM
#4
Re: String data type internat representation
You can use text = StrConv(text, vbUnicode)
to store strings that are 2 byte Unicode.
-
May 4th, 2005, 05:42 AM
#5
Thread Starter
Hyperactive Member
Re: String data type internal representation
ok. But can I store these Unicode converted strings in the default VB6 String type or do I need to create an array of my own?
-
May 4th, 2005, 05:47 AM
#6
Re: String data type internat representation
Looks like string type works. 
VB Code:
Option Explicit
Private Sub Form_Load()
Dim a As String
Dim b As String
a = "test"
b = StrConv(a, vbUnicode) ' is just "t" at this point
a = StrConv(b, vbFromUnicode)
MsgBox a ' prints "test"
End Sub
I started with B as a variant, and changed it back into a string.
-
May 4th, 2005, 07:12 AM
#7
Re: String data type internat representation
Yes it is possible!
Use AddIn Manager to load Resource Editor. Create a resource file. Here you can store your strings etc. exactly in a table type format and it is embedded into your exe. You won't need any external tool.
-
May 4th, 2005, 07:37 AM
#8
Re: String data type internat representation
Doh. I'd never bothered with Resource Files in VB, I assumed they were different than their C++ counter-parts.
Meh, that's my stretch of experimentation for you.
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
May 10th, 2005, 01:17 AM
#9
Thread Starter
Hyperactive Member
Re: String data type internat representation
From what I`ve got running dglienna`s code I have these comments :
a) The value of b is actually t e s t . At least that is what I get in Debug mode, using Debug.Print.
b) It seems that the MsgBox function cannot handle correctly the two-byte Unicode string. That is why it prints a single 't'.
Am I wrong somewhere?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|