Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. i have some question about api MOUSE event.

i have some question about api MOUSE event.

Scheduled Pinned Locked Moved C / C++ / MFC
questiongraphicsjson
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jung Seng Won
    wrote on last edited by
    #1

    this is part of my code. and i am making some drawing line. first, i put my left_mousebutton then point is displayed, but the line don't draw~ it is good if i delete "WM_LBUTTONUP". can you tell me why this happen? HDC hdc; PAINTSTRUCT ps; static TCHAR str[200] ; int len; static int x = 100; static int y = 100; static bool b_start = false; case WM_LBUTTONDOWN: x = LOWORD(lParam); y = HIWORD(lParam); b_start = true; return 0; case WM_MOUSEMOVE: if(b_start == true) { hdc = GetDC(hWnd); MoveToEx(hdc, x, y, NULL); x = LOWORD(lParam); y = HIWORD(lParam); LineTo(hdc, x, y); ReleaseDC(hWnd, hdc); }//b_start == true case WM_LBUTTONUP: b_start = false; return 0; }//iMessage return (DefWindowProc(hWnd, iMessage, wParam, lParam)); }//LRESULT

    Thank you everyone~

    F V 2 Replies Last reply
    0
    • J Jung Seng Won

      this is part of my code. and i am making some drawing line. first, i put my left_mousebutton then point is displayed, but the line don't draw~ it is good if i delete "WM_LBUTTONUP". can you tell me why this happen? HDC hdc; PAINTSTRUCT ps; static TCHAR str[200] ; int len; static int x = 100; static int y = 100; static bool b_start = false; case WM_LBUTTONDOWN: x = LOWORD(lParam); y = HIWORD(lParam); b_start = true; return 0; case WM_MOUSEMOVE: if(b_start == true) { hdc = GetDC(hWnd); MoveToEx(hdc, x, y, NULL); x = LOWORD(lParam); y = HIWORD(lParam); LineTo(hdc, x, y); ReleaseDC(hWnd, hdc); }//b_start == true case WM_LBUTTONUP: b_start = false; return 0; }//iMessage return (DefWindowProc(hWnd, iMessage, wParam, lParam)); }//LRESULT

      Thank you everyone~

      F Offline
      F Offline
      followait
      wrote on last edited by
      #2

      just debug

      1 Reply Last reply
      0
      • J Jung Seng Won

        this is part of my code. and i am making some drawing line. first, i put my left_mousebutton then point is displayed, but the line don't draw~ it is good if i delete "WM_LBUTTONUP". can you tell me why this happen? HDC hdc; PAINTSTRUCT ps; static TCHAR str[200] ; int len; static int x = 100; static int y = 100; static bool b_start = false; case WM_LBUTTONDOWN: x = LOWORD(lParam); y = HIWORD(lParam); b_start = true; return 0; case WM_MOUSEMOVE: if(b_start == true) { hdc = GetDC(hWnd); MoveToEx(hdc, x, y, NULL); x = LOWORD(lParam); y = HIWORD(lParam); LineTo(hdc, x, y); ReleaseDC(hWnd, hdc); }//b_start == true case WM_LBUTTONUP: b_start = false; return 0; }//iMessage return (DefWindowProc(hWnd, iMessage, wParam, lParam)); }//LRESULT

        Thank you everyone~

        V Offline
        V Offline
        Vince Rojas
        wrote on last edited by
        #3

        Perhaps you forgot to put a 'return 0': case WM_MOUSEMOVE: if(b_start == true) { hdc = GetDC(hWnd); MoveToEx(hdc, x, y, NULL); x = LOWORD(lParam); y = HIWORD(lParam); LineTo(hdc, x, y); ReleaseDC(hWnd, hdc); }//b_start == true // <----------------------------------- H E R E case WM_LBUTTONUP: b_start = false; return 0; Only fools rush in. Foo!

        J 1 Reply Last reply
        0
        • V Vince Rojas

          Perhaps you forgot to put a 'return 0': case WM_MOUSEMOVE: if(b_start == true) { hdc = GetDC(hWnd); MoveToEx(hdc, x, y, NULL); x = LOWORD(lParam); y = HIWORD(lParam); LineTo(hdc, x, y); ReleaseDC(hWnd, hdc); }//b_start == true // <----------------------------------- H E R E case WM_LBUTTONUP: b_start = false; return 0; Only fools rush in. Foo!

          J Offline
          J Offline
          Jung Seng Won
          wrote on last edited by
          #4

          it is working when i put return 0, ~ thank you~~

          Thank you everyone~

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups