a Problem for KeyBoardLayout
I want to Add a New KeyBoardLayout to Operating System
But I cant' Acctive it!
BY API:
System::Call "user32::LoadKeyboardLayout(t "0000040a",l 0x00000001)"
please help me!
how can i write This APi Fuction!
Thanks
Archive: a Problem for KeyBoardLayout
a Problem for KeyBoardLayout
I want to Add a New KeyBoardLayout to Operating System
But I cant' Acctive it!
BY API:
System::Call "user32::LoadKeyboardLayout(t "0000040a",l 0x00000001)"
please help me!
how can i write This APi Fuction!
Thanks
You'd also need to call:
http://msdn.microsoft.com/library/de...oardlayout.asp
-Stu
sorry!
i can't use API IN NSIS
can you show me the example?
thank you very much!
you help me always!
You've got the quotes wrong. You use double quotes for both the internal strings and the entire string itself. You're also using a 64-bit integer as the second parameter, instead of a 32-bit integer. Use:
System::Call "user32::LoadKeyboardLayout(t '0000040a',i 0x00000001)"
sorry! i have some question!
why do I need to UnloadkeyboardLayout
?
i can load keyboardlayout,but i can't active it use ctrl+shift!
Do i must Unloadkeyboardlayout another keyboardLayout?
It says you need to unload the currently loaded keyboard layout first, which I'd assume you can get with GetKeyboardLayout.
-Stu
for example:
If I Want to load a keyboardlayout!
I must unload another keyboardlayout first?
or unload current keyboardlayout?
Unload current of course.
-Stu
you see!
System::Call "user32::GetKeyboardLayout(i 0x0) i .r0"
messagebox mb_ok $0
System::Call "user32::UnloadKeyboardLayout(i r0) i .r1"
messagebox mb_ok $1
I can Get a value use the first function,
but I can't get a value use the second function.
it return 0 to me!
how can i write the second function to unload keyBoardLayout?
Try:
System::Call "user32::UnloadKeyboardLayout(i r0) i .r1 ?e"
Pop $2
Now $2 contains the error code from that call. According to MSDN:
If the function fails, the return value is zero. The function can fail for the following reasons:You can then get a list of error codes here
* An invalid input locale identifier was passed.
* The input locale identifier was preloaded.
* The input locale identifier is in use.
?
sorry!
I can't append a keyboardlayout use NSIS
how can i do it ?
i very need to append it !
thanks for all people of reply to me!
System::Call "Imm32.lib::ImmInstallIM(t 'c:\windows\system\jcwb.IME',t '»ù´¡Îå±ÊÊäÈë·¨') i .r1 ?e"
look! this API can append a ime!
but i use this is wrong!
why?
please help me!
SOS
You won't have .lib on there for a start.
-Stu
I can Get a value use the first function,The code I posted calls the GetLastError function which provides extended error information:
but I can't get a value use the second function.
it return 0 to me!
how can i write the second function to unload keyBoardLayout?
If the function fails, the return value is zero. The function can fail for the following reasons:You are getting '0' because the function fails. If you call it using the '?e' switch and pop the value onto $2 then you will get more information about that error. My guess is that you are trying to unload something which is in use, but you will have to get the error value from $2 and find what the actual error is from here.
* An invalid input locale identifier was passed.
* The input locale identifier was preloaded.
* The input locale identifier is in use.
sorry!
I can't append a keyboardlayout use NSIS
how can i do it ?
i very need to append it !
System::Call "user32::GetKeyboardLayout(i 0x0) i .r0"I am sorry but maybe I am missing something here. You call a function that tells you what the Keyboard layout is and then you call another function that unloads that keyboard layout. Then you ask why you can't append a keyboardlayout ...
messagebox mb_ok $0
System::Call "user32::UnloadKeyboardLayout(i r0) i .r1"
messagebox mb_ok $1
s
thanks
I want to append a keyboardlayout!
i use unloadkeyboardlayout append!
but i can't change keyboardlayout use ctrl+shift!
Afrow Uk tell me i need unload a keyboardlayout!
so I use getKeyBoardLayout get a hwnd.
then i use unloadkeyboardlayout to unload current keyboardlayout.
but i can't change keyboardlayout use ctrl+shift yet!
why????
if after i append a keyboardlayout to language cote!
than change keyboardlayout use ctrl+shift!
how can i do it!
help me!
System::Call "user32::GetKeyboardLayout(i 0x0) i .r0"
System::Call "user32::UnloadKeyboardLayout(i r0) i .r1 ?e"
Pop $2
The UnloadKeyboardLayout fails and gives you $1=0. If you run it as shown above, it will give you extended error information on $2. What is the value of $2? Look it up on the MSDN windows error codes page. Then you will have a clue as to why the call fails. My guess is that you have only a single keyboard layout and you are trying to unload it (so you may need to load a new one with LoadKeyboardLayout), or you have multiple layouts but you are trying to unload one that is in use. Check the value of $2 and then we can figure out what's going on.the error number is 126.
my guess is that i want to unload current keyboard layout,
so i can't unload it.
but how can i unload the another keyboard layout?
i can see the keyboardlayout in language cote!
but i cant use it!
Error 126 doesn't make much sense (module not found) so it must be something else.
I tried the following on my computer and it works:
!define KLF_REORDER 8
!define KLF_ACTIVATE 1
# Get the current layout (running thread)
System::Call 'user32::GetKeyboardLayout(i 0)i.r1'
DetailPrint "Keyboard layout is $1" ; I get 67699721 for US english
# Load Greek layout
System::Call 'user32::LoadKeyboardLayoutA(t "00000408", i ${KLF_ACTIVATE})i.r2'
# Load French Layout
System::Call 'user32::LoadKeyboardLayoutA(t "0000040c", i ${KLF_ACTIVATE})i.r3'
# Activate the Greek layout
System::Call 'user32::ActivateKeyboardLayout(i 0x0408, i ${KLF_REORDER})i.r4'
# Check to see that it is loaded
System::Call 'user32::GetKeyboardLayout(i 0)i.r1'
DetailPrint "Keyboard layout is now $1" ; I get 67634184 for greek
# Unload the greek keyboard
System::Call 'user32::UnloadKeyboardLayout(i r1)i.r2'
# Activate French Layout
System::Call 'user32::ActivateKeyboardLayout(i 0x040c, i ${KLF_REORDER})i.r3'
# Check to see that it is loaded
System::Call 'user32::GetKeyboardLayout(i 0)i.r1'
DetailPrint "Keyboard layout is now $1" ; I get 67896332 for French layout
# Unload the French keyboard
System::Call 'user32::UnloadKeyboardLayout(i r1)i.r2'
I kind of liked the idea of loading keyboard layouts and wrote a small macro that will do just that. All you have to do is pass a hex string with the keyboard layout ID to the macro and it will check to see if that layout is loaded, if not it will load it and then it will activate it :)
!macro LoadLangLayout LangID
!define Index "Line${__LINE__}"
StrCpy $8 "${LangID}" "" 2
StrCpy $8 "0000$8"
System::Alloc ${NSIS_MAX_STRLEN}
Pop $R0
System::Call 'user32::GetKeyboardLayoutList(i ${NSIS_MAX_STRLEN}, i R0)i.r0'
StrCpy $9 1
loop-${Index}:
System::Call '*$R0(i .r1)'
IntFmt $2 "%08x" $1
StrCpy $3 $2 "" -4
StrCpy $4 "0x$3"
IntOp $R0 $R0 + 4
StrCmp $4 ${LangID} macro_end_${Index}
StrCmp $9 $0 loop_end-${Index}
IntOp $9 $9 + 1
Goto loop-${Index}
loop_end-${Index}:
System::Call 'user32::LoadKeyboardLayoutA(t r8, i 1)i.r0'
macro_end_${Index}:
System::Call 'user32::ActivateKeyboardLayout(i ${LangID}, i 8)i.r0'
!undef Index
!macroend
To use it call the macro from within your NSIS script:
!insertmacro LoadLangLayout 0x0409
the first method can append a keyboardlayout to language bar.
but can't use ctrl+shift to change between layouts.
the second method can't use it!
why?
what version is your Operating System?
I use windows XP professional!
MY nsis version is 2.16!
Both methods do the same thing. Both methods work for me. They both load a new keyboard layout and activate it. I am able to cycle through multiple layouts using CTRL-SHIFT. I am also using XP Pro and both methods should work on NT/2000/XP/2k3 (tested it in 2k as well and it is working fine).
You do reallize that the code provided here will add the languages to the current thread, but it will not 'make' the language bar appear, ie you need to have at least two layouts active before running this code, with the language bar visible so that you will see the new layouts. Also this code will not add a hotkey combination in order to cycle through the layouts, this is something that you should do prior to running the code.
What language are you trying to load? Running the last macro I posted for 0x040a (if that's what you are trying to load) I get a Spanish layout loaded.
CF
i have three layouts on my language bar!
i use your same code, i can't append any keyboardlayouts to language bar!
do you know a API can refresh layouts list?
i think i run short of this API Function!
Could you please post the code that you are trying to run and is not working?
CF