473,322 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

IsTextUnicode API - Using VB.NET

Are there any examples of anyone using the IsTextUnicode API with VB.NET or
C#.NET. We currently use it with VB6 and need to convert to VB.NET
--
Andrew Strickler
JPMorganChase Development
Jul 21 '05 #1
1 4090
Andrew,
I have not specifically used the function, however the following works:

Declare Auto Function IsTextUnicode Lib "Advapi32" (ByVal buffer() As
Byte, ByVal length As Integer, ByRef options As IsTextUnicodeFlags) As
Boolean

<Flags()> _
Public Enum IsTextUnicodeFlags As Integer
Ascii16 = &H1
ReverseAscii16 = &H10

Statistics = &H2
ReverseStatistics = &H20

Controls = &H4
ReverseControls = &H40

Signature = &H8
ReverseSignature = &H80

IllegalChars = &H100
OddLength = &H200
DbcsLeadbyte = &H400

NullBytes = &H1000

UnicodeMask = &HF
ReverseMask = &HF0
NotUnicodeMask = &HF00
NotAsciiMask = &HF000

End Enum

Public Shared Sub Main()
Dim str As String = "Hello world"
Dim buffer() As Byte
Dim options As IsTextUnicodeFlags
buffer = System.Text.Encoding.Unicode.GetBytes(str)
options = IsTextUnicodeFlags.UnicodeMask
Debug.WriteLine(Nothing)
Debug.WriteLine(IsTextUnicode(buffer, buffer.Length, options),
"isTextUnicode")
Debug.WriteLine(options, "options")

buffer = System.Text.Encoding.Default.GetBytes(str)
options = IsTextUnicodeFlags.UnicodeMask
Debug.WriteLine(Nothing)
Debug.WriteLine(IsTextUnicode(buffer, buffer.Length, options),
"isTextUnicode")
Debug.WriteLine(options, "options")

buffer = New Byte() {&H41, &HA, &HD, &H1D}
options = IsTextUnicodeFlags.UnicodeMask
Debug.WriteLine(Nothing)
Debug.WriteLine(IsTextUnicode(buffer, buffer.Length, options),
"isTextUnicode")
Debug.WriteLine(options, "options")

End Sub

Hope this helps
Jay

"Andrew STrickler" <An*************@discussions.microsoft.com> wrote in
message news:8D**********************************@microsof t.com...
Are there any examples of anyone using the IsTextUnicode API with VB.NET
or
C#.NET. We currently use it with VB6 and need to convert to VB.NET
--
Andrew Strickler
JPMorganChase Development

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: rawCoder | last post by:
Hi All, I have a *.cer file, a public key of some one and I want to encrypt some thing using this public key. Can someone point me to a sample code for Encrypting some file using...
1
by: Mike | last post by:
When trying to compile (using Visual Web Developer 2005 Express Beta; frameworkv2.0.50215 ) the source code below I get errors (listed below due to the use of ICallBackEventHandler. Ultimately I...
10
by: Christopher Benson-Manica | last post by:
Why can't I use a class destructor in a using declaration: using MyClass::~MyClass; ? -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org ...
17
by: beliavsky | last post by:
Many of my C++ programs have the line using namespace std; but the "Accelerated C++" book of Koenig and Moo has many examples where the library names are included one at a time, for example ...
8
by: Petter Reinholdtsen | last post by:
I ran into a problem on HP-UX 11.00 the other day, where it refused to compile a program using 'using namespace std;' at the top. The reason seem to be that the compiler refuses to accept 'using...
14
by: john.burton.email | last post by:
I've done some extensive searching and can't seem to find an answer to this - Is it correct to using "using" with templates, for example: using std::vector; Or do I need to specify the type...
5
by: Enos Meroka | last post by:
Hallo, I am a student doing my project in the university.. I have been trying to compile the program using HP -UX aCC compiler, however I keep on getting the following errors. ...
1
by: Andrew STrickler | last post by:
Are there any examples of anyone using the IsTextUnicode API with VB.NET or C#.NET. We currently use it with VB6 and need to convert to VB.NET -- Andrew Strickler JPMorganChase Development
3
by: JDeats | last post by:
I have some .NET 1.1 code that utilizes this technique for encrypting and decrypting a file. http://support.microsoft.com/kb/307010 In .NET 2.0 this approach is not fully supported (a .NET 2.0...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.