Author Topic: MsgWaitForMultipleObjects wrong value Value  (Read 1017 times)

ragdog

  • Member
  • ****
  • Posts: 610
MsgWaitForMultipleObjects wrong value Value
« on: January 09, 2019, 12:01:46 AM »
Hello

I working with threads and MsgWaitForMultipleObjects and wonder why my wait code is not successful.
In all Masm32 version is in the windws.inc the wrong value.

QS_ALLINPUT = 000000FF     is wrong it should  04FFh


Update qs_... value
Code: [Select]
QS_KEY            equ 1h
QS_MOUSEMOVE      equ 2h
QS_MOUSEBUTTON    equ 4h
QS_MOUSE          equ 6h ;<<<<<<<<<<<<<<< missing
QS_POSTMESSAGE    equ 8h
QS_TIMER          equ 10h
QS_PAINT          equ 20h
QS_SENDMESSAGE    equ 40h
QS_HOTKEY         equ 80h
QS_ALLPOSTMESSAGE equ 100h
QS_RAWINPUT       equ 400h ;<<<<<<<<<<< missing
QS_MOUSE          equ QS_MOUSEMOVE OR QS_MOUSEBUTTON


;QS_INPUT
;0x407
;An input message is in the queue.
;This value is a combination of QS_MOUSE, QS_KEY, and QS_RAWINPUT.

QS_INPUT         equ QS_MOUSE OR QS_KEY or QS_RAWINPUT ; <<< update
QS_ALLEVENTS     equ QS_INPUT OR QS_POSTMESSAGE OR QS_TIMER OR QS_PAINT OR QS_HOTKEY


;QS_ALLINPUT
;0x04FF
;Any message is in the queue.
This value is a combination of QS_INPUT, QS_POSTMESSAGE, QS_TIMER, QS_PAINT, QS_HOTKEY, and QS_SENDMESSAGE.

;QS_ALLINPUT  equ QS_SENDMESSAGE OR QS_PAINT OR QS_TIMER OR QS_POSTMESSAGE OR QS_MOUSEBUTTON OR QS_MOUSEMOVE OR QS_HOTKEY OR QS_KEY
QS_ALLINPUT equ  QS_INPUT OR QS_POSTMESSAGE OR QS_TIMER OR QS_PAINT OR QS_HOTKEY OR QS_SENDMESSAGE  ;<<< update

Greets,

dedndave

  • Member
  • *****
  • Posts: 8823
  • Still using Abacus 2.0
    • DednDave
Re: MsgWaitForMultipleObjects wrong value Value
« Reply #1 on: January 09, 2019, 03:02:07 AM »
Code: [Select]
QS_MOUSE          equ 6h ;<<<<<<<<<<<<<<< missing
QS_POSTMESSAGE    equ 8h
QS_TIMER          equ 10h
QS_PAINT          equ 20h
QS_SENDMESSAGE    equ 40h
QS_HOTKEY         equ 80h
QS_ALLPOSTMESSAGE equ 100h
QS_RAWINPUT       equ 400h ;<<<<<<<<<<< missing
QS_MOUSE          equ QS_MOUSEMOVE OR QS_MOUSEBUTTON

your text says QS_MOUSE is missing, yet it is listed as QS_MOUSEMOVE OR QS_MOUSEBUTTON ( = 6 )

dedndave

  • Member
  • *****
  • Posts: 8823
  • Still using Abacus 2.0
    • DednDave
Re: MsgWaitForMultipleObjects wrong value Value
« Reply #2 on: January 09, 2019, 03:06:37 AM »
my version has QS_RAWINPUT, but it is not listed in the same area of windows.inc  :P

jj2007

  • Member
  • *****
  • Posts: 9635
  • Assembler is fun ;-)
    • MasmBasic
Re: MsgWaitForMultipleObjects wrong value Value
« Reply #3 on: January 09, 2019, 03:24:37 AM »
QS_ALLINPUT = 000000FF     is wrong it should  04FFh

Are you sure? Visual Studio lists these:
Code: [Select]
#define QS_ALLINPUT        (QS_INPUT         | \
                            QS_POSTMESSAGE   | \
                            QS_TIMER         | \
                            QS_PAINT         | \
                            QS_HOTKEY        | \
                            QS_SENDMESSAGE)
Hint: the right value depends on the OS version 8)

dedndave

  • Member
  • *****
  • Posts: 8823
  • Still using Abacus 2.0
    • DednDave
Re: MsgWaitForMultipleObjects wrong value Value
« Reply #4 on: January 09, 2019, 03:32:23 AM »
the one to look at is QS_INPUT, Jochen  :t
according to MS, it includes QS_RAWINPUT
if you straighten that one out, then fix the definition for QS_ALLINPUT, you should be good to go


i updated my windows.inc file, as follows...
1) move the value for QS_RAWINPUT
it was located about half-way through the file, between MAPVK_VK_TO_VSC_EX and USER_TIMER_MAXIMUM
i moved it up, near the other QS_ values
2) i then updated the combined values, per MS documentation

Code: [Select]
QS_KEY                               equ 1h
QS_MOUSEMOVE                         equ 2h
QS_MOUSEBUTTON                       equ 4h
QS_POSTMESSAGE                       equ 8h
QS_TIMER                             equ 10h
QS_PAINT                             equ 20h
QS_SENDMESSAGE                       equ 40h
QS_HOTKEY                            equ 80h
QS_ALLPOSTMESSAGE                    equ 100h
QS_RAWINPUT                          equ 400h
QS_MOUSE                             equ QS_MOUSEMOVE OR QS_MOUSEBUTTON
QS_INPUT                             equ QS_MOUSE OR QS_KEY OR QS_RAWINPUT
QS_ALLEVENTS                         equ QS_INPUT OR QS_POSTMESSAGE OR QS_TIMER OR QS_PAINT OR QS_HOTKEY
QS_ALLINPUT                          equ QS_INPUT OR QS_POSTMESSAGE OR QS_TIMER OR QS_PAINT OR QS_HOTKEY OR QS_SENDMESSAGE

TimoVJL

  • Member
  • ***
  • Posts: 408
Re: MsgWaitForMultipleObjects wrong value Value
« Reply #5 on: January 09, 2019, 05:31:55 AM »
So since WindowsXP
Code: [Select]
#if(_WIN32_WINNT >= 0x0501)
#define QS_RAWINPUT         0x0400
#endif /* _WIN32_WINNT >= 0x0501 */

#define QS_MOUSE           (QS_MOUSEMOVE     | \
                            QS_MOUSEBUTTON)

#if (_WIN32_WINNT >= 0x0501)
#define QS_INPUT           (QS_MOUSE         | \
                            QS_KEY           | \
                            QS_RAWINPUT)
#else
#define QS_INPUT           (QS_MOUSE         | \
                            QS_KEY)
#endif // (_WIN32_WINNT >= 0x0501)
May the source be with you

ragdog

  • Member
  • ****
  • Posts: 610
Re: MsgWaitForMultipleObjects wrong value Value
« Reply #6 on: January 09, 2019, 10:27:42 PM »
Quote
then updated the combined values, per MS documentation

Correct Dave :t  :t