Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Can't trap mouse WM_LBUTTONUP events

$
0
0

I have a running application in x64 mode and I wanted to trap a WM_LEFTBUTTONDOWN event, translate the mouse position to my real world coordinates and write out those coordinates on my GUI and then immediately pick up the WM_LBUTTONUP event and basicall erase the text I had just written. Either I'm not getting the second event or my XOR mode of writing is not working. Any ideas? Here is the code:

!======================================
      case (WM_LBUTTONDOWN)
!======================================
         mx = LOWORD(lParam)       
         my = HIWORD(lParam)
!        mx = GET_X_LPARAM(lParam)
!        my = GET_Y_LPARAM(lParam)
         Call M2R (mx, my, xm, ym)
         write(TxtOut,'(f8.2,1x,f8.2)') xm, ym
         hDC = GetDC(ghWndMain)
         if (hDC == NULL) Then
            WinMainProc = 0
            return
         end if
         ghPen = CreatePen(PS_SOLID, 2, RGB(0,0,0))   ! Thick black Pen
         bret = SelectObject(hDC, ghPen)
         ret = SetROP2(hDC, R2_XORPEN)
         iret = SetBkMode(hDC,TRANSPARENT)
         bret = textOut(hDC, mx, my, TxtOut, 17)
         WinMainProc = -1
         return

!======================================
      case (WM_LBUTTONUP)
!======================================

         bret = textOut(hDC, mx, my, TxtOut, 17)
         bret = DeleteObject(ghPen)
         bret = DeleteDC (hDC)
         WinMainProc = -1
         return

 

Thanks for looking at it. BTW, the first part is working flawlessly. Just not erasing the text I've written.

Brooks


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>