Click to See Complete Forum and Search --> : Mouse operations in VB.NET when using opengl


s_kannan55
June 17th, 2008, 03:29 AM
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?

HanneSThEGreaT
June 17th, 2008, 08:39 AM
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...

s_kannan55
June 17th, 2008, 12:18 PM
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

HanneSThEGreaT
June 18th, 2008, 12:36 AM
Why not try the GetCursorPos API ¿

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

Marraco
June 18th, 2008, 08:13 AM
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 :cry: )