What LDC flags should be used to get the fastest executable on Windows?

Preetpal preetpal.sohal at gmail.com
Sat Mar 6 15:59:56 UTC 2021


On Saturday, 6 March 2021 at 11:48:55 UTC, Imperatorn wrote:
> On Saturday, 6 March 2021 at 11:34:33 UTC, Imperatorn wrote:
>> On Saturday, 6 March 2021 at 10:51:35 UTC, Preetpal wrote:
>>> On Saturday, 6 March 2021 at 09:07:05 UTC, Imperatorn wrote:
>>>> [...]
>>>
>>> There is an issue with the code where the running program 
>>> very infrequently misses when the SHIFT key is released. As 
>>> this program keeps track of what modifier keys are currently 
>>> pressed (as it is supposed keep track of all key presses and 
>>> key releases), this can cause the wrong keyboard shortcut to 
>>> be triggered.
>>>
>>> [...]
>>
>> I see, back in the day when I did stuff like this, I used 
>> GetAsyncKeyState instead. Have you tried that approach?
>
> Or maybe it was GetKeyboardState, don't remember, was about 17 
> years ago 😁

According to the documentation 
(https://docs.microsoft.com/en-us/windows/win32/winmsg/lowlevelkeyboardproc) for the LowLevelKeyboardProc (the hook that my program installs), the hook is "called before the asynchronous state of the key is updated" so I cannot use GetAsyncKeyState.

I could probably use GetKeyboardState to make the program simpler 
but since I fixed it, I am probably not going to change it for a 
while :).


More information about the digitalmars-d-ldc mailing list