CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2000
    Location
    Washington (state)
    Posts
    125

    [RESOLVED] VB equivalent for C++ GetLocaleInfo

    Is there a VB equivalent function to the following C++ function?

    Code:
    ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLIST, szBuf, sizeof(szBuf)) ;

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: VB equivalent for C++ GetLocaleInfo

    is this what you are looking for ?

    Code:
    Public Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long

  3. #3
    Join Date
    Apr 2000
    Location
    Washington (state)
    Posts
    125

    Re: VB equivalent for C++ GetLocaleInfo

    Well... it may be...

    I declared it as you provided it...
    Then I am using it like this... (FYI... I don't know much about VB... I am more familiar with C++)

    Code:
    Dim txt As String
    Dim lResult As Long
    
    lResult = GetLocaleInfo(1024, 12, txt, 100)
    I get 1024 and 12 from the definitions of LOCALE_USER_DEFAULT and LOCALE_SLIST which I am using in a C++ app...

    txt comes back empty... and lResult comes back as zero...
    The C++ version seems to work quite well...

    I will be very grateful for any suggestions you can offer... Thanks!

  4. #4
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: VB equivalent for C++ GetLocaleInfo

    Take a look at the sample which at the bottom which at the bottom of this page
    http://allapi.mentalis.org/apilist/GetLocaleInfo.shtml

  5. #5
    Join Date
    Apr 2000
    Location
    Washington (state)
    Posts
    125

    Re: VB equivalent for C++ GetLocaleInfo

    That example was very helpful...
    It turns out the only thing I needed to change was to init the buffer

    Code:
    Dim Buffer As String, Ret As String
     Buffer = String$(256, 0)                      '<-- LIKE THIS...
     Ret = GetLocaleInfo(LOCALE_USER_DEFAULT, lInfo, Buffer, Len(Buffer))

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured