VkKeyScanEx_ and Unicode [Resolved]

Just starting out? Need help? Post your questions and find answers here.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5502
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

VkKeyScanEx_ and Unicode [Resolved]

Post by Kwai chang caine »

Hello at all

Before v5.50 i use sendkey function with VkKeyScanEx_() inside and all are done
But now with UNICODE apparently VkKeyScanEx_() not have the same behavior :shock:

Code: Select all

vk$ = "5"
vk=VkKeyScanEx_(Asc(vk$),GetKeyboardLayout_(0))
keybd_event_(vk,0,0,0) 
When i send number the sendkey not use number pad key, but keys at the top of the keyboard and write
"(" instead of "5"
"é" instead of "2" :|

I have see they are a Unicode version of VkKeyScanEx_ (VkKeyScanExW_) but PB not recognize it :|
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

How can i do, for be retrieve the old behavior of my ASCII sendkeys

Have a good day
Last edited by Kwai chang caine on Tue Nov 15, 2016 6:31 pm, edited 1 time in total.
ImageThe happiness is a road...
Not a destination
User avatar
GeBonet
Enthusiast
Enthusiast
Posts: 135
Joined: Fri Apr 04, 2008 6:20 pm
Location: Belgium

Re: VkKeyScanEx_ and Unicode

Post by GeBonet »

I think the Windows API understands only the French keyboard, trying to go under French keyboard (Belgium) and test this is perhaps only that?
Sorry for my english :wink: ! (Windows Xp, Vista and Windows 7, Windows 10)
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5502
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: VkKeyScanEx_ and Unicode

Post by Kwai chang caine »

Hello GEBONET.... 8)
They are a very long time i never read you
I believe you are died :lol:
I think the Windows API understands only the French keyboard, trying to go under French keyboard (Belgium) and test this is perhaps only that?
It's strange because the US keyboard have a numeric pad too no ??? :shock:
ImageThe happiness is a road...
Not a destination
User avatar
GeBonet
Enthusiast
Enthusiast
Posts: 135
Joined: Fri Apr 04, 2008 6:20 pm
Location: Belgium

Re: VkKeyScanEx_ and Unicode

Post by GeBonet »

Sorry not yet :cry: !!! Yes the keyboards are the same except that the reference table is somewhat different between the Belgian and the French or the function keys are not in the same place and there is an inversion between the figures and what accompanies it c ' Is so that the 2 becomes "é", the 5 = "(" etc ... But the test that I propose to you is simply to confirm and not to solve ... Try by setting the Belgian keyboard default and then returns To French after ... On this, I only pass ... And big kiss for all the time we have not seen :D ?
Sorry for my english :wink: ! (Windows Xp, Vista and Windows 7, Windows 10)
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5502
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: VkKeyScanEx_ and Unicode

Post by Kwai chang caine »

Thanks to your answer....at the pleasure to read you another time :wink:
ImageThe happiness is a road...
Not a destination
User avatar
GeBonet
Enthusiast
Enthusiast
Posts: 135
Joined: Fri Apr 04, 2008 6:20 pm
Location: Belgium

Re: VkKeyScanEx_ and Unicode

Post by GeBonet »

Avec plaisir également... Au besoin, tu sais ou j'habite (privé). :D :D
Sorry for my english :wink: ! (Windows Xp, Vista and Windows 7, Windows 10)
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5502
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: VkKeyScanEx_ and Unicode

Post by Kwai chang caine »

A pied c'est un peu loin.... :lol:
Mais grâce à la fée électricité....... les kilometres n'ont plus lieu d'être 8)
A bientôt :wink:
ImageThe happiness is a road...
Not a destination
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5502
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: VkKeyScanEx_ and Unicode

Post by Kwai chang caine »

I have found that alone...that's works...but i don't know why :oops:

Code: Select all

WinLib = OpenLibrary(#PB_Any, "User32.dll")
vk$ = "5"

If GetFunction(WinLib, "VkKeyScanExA")
 Debug CallFunction(WinLib, "VkKeyScanExA", Asc(Vk$), GetKeyboardLayout_(0))
EndIf

CloseLibrary(WinLib)
ImageThe happiness is a road...
Not a destination
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5502
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: VkKeyScanEx_ and Unicode [Resolved]

Post by Kwai chang caine »

Finally, i have found another solution for sendkeys, who works with UNICODE
With the EBS code 8)
http://www.purebasic.fr/english/viewtop ... 1486#31486
ImageThe happiness is a road...
Not a destination
Post Reply