Recent

Author Topic: GetKeyState(VK_SHIFT)  (Read 23856 times)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: GetKeyState(VK_SHIFT)
« Reply #30 on: January 19, 2017, 08:19:45 pm »
Do you have a FormKeyDown or any other key related event in your form/program?

(where you might mess up the state)
Yes, i have. I will have a quick look.....
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: GetKeyState(VK_SHIFT)
« Reply #31 on: January 19, 2017, 08:25:47 pm »
Do you have a FormKeyDown or any other key related event in your form/program?

(where you might mess up the state)
Yes, i have. I will have a quick look.....
It's set after the first two calls to CheckIgnoreFileList...so no luck here :(
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: GetKeyState(VK_SHIFT)
« Reply #32 on: January 19, 2017, 08:26:59 pm »
If one program correctly outputs 32768 or 0 and another wrongly outputs 1 or 0 for the same function call, then there must be some sort of issue in the second program.
Yes, obviously  :D
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: GetKeyState(VK_SHIFT)
« Reply #33 on: January 19, 2017, 08:41:02 pm »
OT: Wondering what causes the difference in return values of GetKeyState between Linux / Windows. Anyone knows?
The Windows-version (through the widgetset) calls the GetKeyState-API. It's really simple.

The GTK2 version does a lot more things and tries to emulate (I think) the Windows GetKeyState-API. But apparently they used a mask of -128 ($FF80) to mark the bits and pieces ending up in a different value.
Code: Pascal  [Select][+][-]
  1. const
  2.   StateDown    = SmallInt($FF80);
Maybe that should have been $8000 for complete compatibility.
(and for those who think it's not "emulating" Windows.... this function is in gtk3winapi.inc :D )

 

TinyPortal © 2005-2018