Here's the program that I thought would give me the answer:
use strict; use warnings; use Win32::API; Win32::API->Import('kernel32.dll', 'LANGID GetSystemDefaultLangID()') +or die "Can't import GetSystemDefaultLangID: $^E\n"; my $langid = GetSystemDefaultLangID(); if (defined $langid) { print "Returned '$langid'\n"; printf "Lang ID: 0x%04X\n", $langid; } else { print "Returned <undef>\n"; }
However, when I run this it just outputs:
Returned <undef>
The function itself works fine from a simple C program:
#include <stdio.h> #include <windows.h> #include <winnls.h> void main(void) { printf("Lang ID = 0x%04X\n", GetSystemDefaultLangID()); }
and similar Perl Win32::API programs involving other Win32 API functions also work fine, e.g.
use strict; use warnings; use Win32::API; Win32::API->Import('kernel32.dll', 'DWORD GetCurrentProcessId()') or die "Can't import GetCurrentProcessId: $^E\n"; my $procid = GetCurrentProcessId(); if (defined $procid) { print "Returned '$procid'\n"; } else { print "Returned <undef>\n"; }
Where can I have gone wrong with something so simple, or is this a bug in Win32::API?
- Steve
In reply to How to call GetSystemDefaultLangID() with Win32::API by shay
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |