How to call Kernel32 GetCPInfoEx
Posted on 2001-06-23
I have the following (I trimmed the rest of the code) coded:
Public Type CPINFOEX
MaxCharSize As Long
DefaultChar() As Byte
LeadByte() As Byte
UnicodeDefaultChar As Byte
CodePage As Integer
CodePageName As String * 128
Public Declare Function GetCPInfoEx Lib "kernel32" Alias "GetCPInfoExA" (ByVal CodePage As Long, ByVal Flags As Long, lpCPInfo As CPINFO) As Long
Dim cpi As Long
Dim lpCharSet As CPINFOEX
cpi = 0
lpCharSet.CodePageName = Space$(128)
cpi = GetCPInfoEx(oSQL_Server.CodePage, cpi, lpCharSet)
However it does not work. There seems to be a mismatch in the lpCPInfo structure. Can anyone tell me what the correct calling structure within VB is please.
I do not want to call the GetCPInfo DLL as its only the Extended version that gives me what I want (the Code Page Name given a code page number).
I took the definitions from the Windows SDK.
Also does anyone have a mapping between DLL Data types and VB data types. I know about the API viewer. But it only helps so far and does not list the GetCPInfoEx function at all.