Re: Bitwise operating...is that the term?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Some advice,

if both values if 16-bit, say, you can always mask it with AND operator with
number (better work with hexadecimal) - &H8xxx

That make sure the the number output always negative.
(Correct me if I am wrong)

If you want invert the lParam somehow, when pos-, change to neg-, and vice
versa, then use XOR operator.

Again, with that magic number(huh?) - &H8xxx

0 XOR 1 = 1
1 XOR 1 = 0
(the right operand is the &H8xxxx - '8' - 1000)

Also, it is confusing if put bitwise 'operating', I prefer, I think to many
peoples wish as well - bitwise arithmetic will be much better.


"YYZ" <matt@xxxxxxxxx> wrote in message
news:1123034811.225826.160030@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> There is an addin for VB6 that makes the mousewheel work in the IDE,
> and it works great, unless you have multiple monitors and have them
> setup in a certain configuration (in my case, 3, with the one on the
> far right being the primary monitor).
>
> The code in the subclassed WindowProc function is incorrectly finding
> the position of the X coordinate of the mouse. It is finding the X
> coordinate of the mouse by taking lParam and ANDing it with 65535 --
> lParam AND 65535, oddly enough.
>
> Now, if the real x coordinate is negative (say, -200), then lParam AND
> 65535 returns a very large number, something along the lines of 64992,
> I believe (sorry I don't have exact numbers because I can't post from
> work, and I don'thave the multiple monitors at home.)
>
> So, if lparam is 19660186, what would I AND with that to find a low
> negative number? How would I make it return the correct X coordinates
> for positive and negative numbers?
>
> Oh -- the reason it needs the X and Y coords of the mouse is because it
> needs to find the window handle of the window under the mouse to send
> the scroll message -- pthWnd = WindowFromPointXY(XPos, YPos)
>
> Thanks for any advice anyone has out there.
>
> Matt
>



.



Relevant Pages

  • Bitwise operating...is that the term?
    ... There is an addin for VB6 that makes the mousewheel work in the IDE, ... unless you have multiple monitors and have them ... lParam AND 65535, oddly enough. ... needs to find the window handle of the window under the mouse to send ...
    (microsoft.public.vb.general.discussion)
  • Re: Bitwise operating...is that the term?
    ... Since you are anding the lParam with 65535 I would assume that it is a 16 ... unless you have multiple monitors and have them ... > needs to find the window handle of the window under the mouse to send ...
    (microsoft.public.vb.general.discussion)
  • Re: How add buton onto title bar of any external active window?
    ... I want to add buttons ontoany active window. ... int sm_CXSIZE; ... static int WindowsFeaturesWidth(HWND hwnd, DWORD style) ... LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Lost with a systemwide hook
    ... I'm not sure what window #32768 represents, ... BOOL CALLBACK HidePopupWindow(HWND hWnd, LPARAM lParam) ... And I don't know which kind of hook is appropriate for all those ... things that happen when this code is executed when injecting into ...
    (microsoft.public.vc.mfc)
  • Child window WM_PAINT messages not delivered. Why?
    ... I have an app where I have a modeless dialog embedded within the client area ... All is well except when another window is moved around ... static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, ... LPARAM lParam); ...
    (microsoft.public.win32.programmer.ui)