Author Topic: WM_CHAR WM_KEYDOWN WM_LBUTTONDOWN  (Read 483 times)

shankle

  • Member
  • ****
  • Posts: 833
WM_CHAR WM_KEYDOWN WM_LBUTTONDOWN
« on: April 24, 2019, 12:32:05 PM »
          4-23-2019

   Subject: WM_CHAR, WM_KEYDOWN, WM_LBUTTONDOWN

   At best IMHO Windows is a very cumbersome Operating System.
   In C. Petzols book on Windows the explanations of the 3 items
   above are vague.
   I need an explanation written for Dummies and it's not in that
   book.
   I have been struggling with which one of the above 3 items to
   put VK_SPACE and VK_ESCAPE for EX. and why it should go there.
   If someone would be kind enough to come down to my level to
   explain this it would appreciated.

       

Yuri

  • Member
  • **
  • Posts: 175
Re: WM_CHAR WM_KEYDOWN WM_LBUTTONDOWN
« Reply #1 on: April 25, 2019, 01:45:52 AM »
WM_LBUTTONDOWN is for left mouse clicks and WM_CHAR is for characters, not keypresses. So you need WM_KEYDOWN. But you don't put anything in it; it's a constant that indentifies the message. Something like this:
Code: [Select]
invoke PostMessage, [hWnd], WM_KEYDOWN, VK_SPACE, 0
invoke Sleep, 50
invoke PostMessage, [hWnd], WM_KEYUP, VK_SPACE, 0xC0000001

shankle

  • Member
  • ****
  • Posts: 833
Re: WM_CHAR WM_KEYDOWN WM_LBUTTONDOWN
« Reply #2 on: April 25, 2019, 07:51:06 AM »
Thank you Yuri.