In you "complex prog" please make sure that you are using the instance of GetKeyState from LCL by using "LCLIntf.GetKeyState(LCLType.VK_SHIFT) and $8000 <> 0"
OT: Wondering what causes the difference in return values of GetKeyState between Linux / Windows. Anyone knows?