Sorry if this post may sound a bit off-topic, but I could not find a
specialized newsgroup. I have created a dotnet 2.0 library containing some
user controls and written in C#. One of the controls (an extension of
RichTextControl ) needs to programmaticall y change the keyboard layout, so it
imports some user32.dll API functions (see below). This control works fine
in Windows XP, but it crashes under Win64 systems when trying to call the
user32 API. How can I change the code so that it runs under Win64 or where
could I find more information about porting API-dependent dotnet code under
this OS?
Thank you in advance!
Code snippets:
// API DECLARATIONS
private const uint KLF_ACTIVATE = 1; // activate the layout
private const int KL_NAMELENGTH = 9; // length of the keyboard buffer
[DllImport("user 32.dll")]
private static extern long LoadKeyboardLay out(
string pwszKLID, // input locale identifier
uint Flags // input locale identifier options
);
[DllImport("user 32.dll")]
private static extern long GetKeyboardLayo utName(
System.Text.Str ingBuilder pwszKLID //[out] string that receives the name
of the locale identifier
);
sample call:
LoadKeyboardLay out("00000409", KLF_ACTIVATE);
specialized newsgroup. I have created a dotnet 2.0 library containing some
user controls and written in C#. One of the controls (an extension of
RichTextControl ) needs to programmaticall y change the keyboard layout, so it
imports some user32.dll API functions (see below). This control works fine
in Windows XP, but it crashes under Win64 systems when trying to call the
user32 API. How can I change the code so that it runs under Win64 or where
could I find more information about porting API-dependent dotnet code under
this OS?
Thank you in advance!
Code snippets:
// API DECLARATIONS
private const uint KLF_ACTIVATE = 1; // activate the layout
private const int KL_NAMELENGTH = 9; // length of the keyboard buffer
[DllImport("user 32.dll")]
private static extern long LoadKeyboardLay out(
string pwszKLID, // input locale identifier
uint Flags // input locale identifier options
);
[DllImport("user 32.dll")]
private static extern long GetKeyboardLayo utName(
System.Text.Str ingBuilder pwszKLID //[out] string that receives the name
of the locale identifier
);
sample call:
LoadKeyboardLay out("00000409", KLF_ACTIVATE);
Comment