Jump to content

dllcall


Recommended Posts

I am trying to use dllcall to get the current keyboard layout, but for some reason it always returns english (0409) this is the code:

$user32dll = DllOpen("user32.dll")
$x = DllCall($user32dll,"long","GetKeyboardLayout","int",0)
MsgBox(0,"",hex($x[0],4))
DllClose($user32dll)

what I thought was maybe this, the parameter I am supposed to give is a thread identifier or 0 for the current thread,

anyone have any thoughts about this?

Link to MSDN - GetKeyboardLayout

Link to comment
Share on other sites

why do you open it?? just remove that line

$x = DllCall($user32dll,"long","GetKeyboardLayout","int",0)
MsgBox(0,"",hex($x[0],4))
*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

  • Developers

that doesn't make any difference, I tried it without opening too

<{POST_SNAPBACK}>

Works fine here....I believe it returns the Default keyboard layout...

returns 0409 when i set the default keyboard to US English

returns 0413 when i set the default to Dutch

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Works fine here....I believe it returns the Default keyboard layout...

returns 0409 when i set the default keyboard to US English

returns 0413 when i set the default to Dutch

<{POST_SNAPBACK}>

oh, well, you know any way to get the current input language, not the default one?

cause the default language is a static thing and what I need is to know in what language the user is currently typing.

thanks anyway

Link to comment
Share on other sites

  • Developers

oh, well, you know any way to get the current input language, not the default one?

cause the default language is a static thing and what I need is to know in what language the user is currently typing.

thanks anyway

<{POST_SNAPBACK}>

But isn't the issue that a new process is shelled which will use the Default language settings ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

But isn't the issue that a new process is shelled which will use the Default language settings ?

<{POST_SNAPBACK}>

yeah, youre right, but how do I get the thread ID of a different process to give to GetKeyboardLayout ?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...