Including Kernel32.dll in VBScript to call GETACP()

jordi79jordi79 Member Posts: 273
Hi,

I need to call the GETAcp function in Kernel32.dll from NAV to get the ANSI codepage in the local client machine. I am having problems in scripting this script. My script is as follows:
Private Declare Function test123 Lib "Kernel32.dll" () As Long 
Msgbox test123

But I am getting compilation errors:

Windows Script Host
Script: C:\temp.vbs
Line: 1
Char: 17
Error: Expected end of statement
Code: 800A0401
Source: Microsoft VBScript compilation error

OK

is there something wrong with my code? Is there any alternative to get the local ANSI code page?

many thanks.

Comments

  • kinekine Member Posts: 12,562
    You can use the Windows Language table to read it for specific language. But you need to select correct language...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • jordi79jordi79 Member Posts: 273
    i assume you are referring to the language table in NAV. This table will only list all the windows language codes. I want to find out what is the language that the local client is using. this can be changed by the users in regional settings. but i want to know what language code is configured, so that I can do some language specific formatting.
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Try WMI call in VBScript instead.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • jordi79jordi79 Member Posts: 273
    Yes. WMI scripts called via VBScript is the solution. it works.
Sign In or Register to comment.