CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2008
    Posts
    32

    Angry Mouse operations in VB.NET when using opengl

    We have developed a VB.Net application in which we are drawing 2D lines using opengl. We are unable to capture mouse events like mouse click, mouse move. How to handle mouse events in VB.Net using opengl?

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Mouse operations in VB.NET when using opengl

    Have you tried API ¿

    For example, these :
    WM_LBUTTONDOWN, WM_RBUTTONDBLCLK, WM_MOUSEMOVE
    with the GetMessage API should tell you The Left Mouse Button is down, The Right MouseButton was double clicked, or your Mouse has moved

    Just a thought...

  3. #3
    Join Date
    May 2008
    Posts
    32

    Talking Re: Mouse operations in VB.NET when using opengl

    The standard handling of Mouse click event in VB.Net doesn't help because the control doesn't go into it's handler function if he form is covered with opengl drawings.
    I have overriden WndProc in our VB.Net application and trapped WM_LBUTTONDOWN message, but I am unable to obtain the coordinates of the mouse position in Window coordinates. According to the documentation in msdn, LParam contains the X and Y coordinates in it's lower and upper words(or vice-versa - I am not sure). The problem is that LParam is an IntPtr . I could not obtain the integer value stored at this location(i.e., LParam). LParam gives the same value irrespective of the location at which I press the left mouse button. Is there a way around this problem? If I can obtain the value stored in LParam location I can do the the standard bitwise left and right shift operations to retrieve the X and Y window coordinates

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Mouse operations in VB.NET when using opengl

    Why not try the GetCursorPos API ¿

    Also, do you have a copy of API Viewer 2004 ¿

  5. #5
    Join Date
    Mar 2007
    Location
    Argentina
    Posts
    579

    Re: Mouse operations in VB.NET when using opengl

    Quote Originally Posted by s_kannan55
    We have developed a VB.Net application in which we are drawing 2D lines using opengl. We are unable to capture mouse events like mouse click, mouse move. How to handle mouse events in VB.Net using opengl?
    I have done that on VB6, by drawing OpenGl to a picturebox window. Then, I simply handled the mouse events of the picturebox.

    (PD: the VB6 OpenGl library was so bad, I decided down my head, and use Direct X in the future. Microsoft is watching you )
    Last edited by Marraco; June 18th, 2008 at 04:30 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured