Download VB5 User's Guide

Transcript
Class names (Name property of a class module, a user control, a property page, or a user document)
DBCS-Enabled KeyPress Event
The KeyPress event can process a double-byte character code as one event. The higher byte of the keyascii argument
represents the lead byte of a double-byte character, and the lower byte represents the trail byte.
In the following example, you can pass a KeyPress event to a text box, whether the character you input is single-byte or
double-byte.
Sub Text1_KeyPress (KeyAscii As Integer)
Mychar = Chr(KeyAscii)
’ Perform an operation using Mychar.
End Sub
For More Information See "KeyPress Event" in the Language Reference in Books Online.
Calling Windows API Functions
Many Windows API and DLL functions return size in bytes. This return value represents the size of the returned string.
Visual Basic converts the returned string into Unicode even though the return value still represents the size of the ANSI or
DBCS string. Therefore, you may not be able to use this returned size as the string’s size. The following code gets the
returned string correctly:
buffer = String(145, Chr(" "))
ret = GetPrivateProfileString(section, _
entry, default, buffer, Len(buffer)-1, filename)
retstring = Left(buffer, Instr(buffer, Chr(0))-1))
For More Information For more information, see "Accessing the Microsoft Windows API" in "Accessing DLLs and the
Windows API" of the Component Tools Guide, available in the Professional and Enterprise editions.