Visual Basic 5 and Opengl

Hello everybody,

Well i was wondering is someone can help me with that Please …

I am using VB5 and an Opengl Ocx created by the waites group found on their Opengl Bible book. The Problem is that they provide a component like the picture box where you can use Opengl commands and functions (most of them) but they only create six events functions with it

1. Render
2. Setuprc
4. getfocus

they do not provide a MouseMove event
So i am trying to find a way to get the mouse position in the component and i can’t
{I am doing a Modeling Program} i want to be able to show the mouse position when the mouse is in mouvement in the component.

I have try everything i can think of but nothing … I put the code in the GetFocus event but it did not works and i even try with the GetFocus event and then again nothing …

So please if someone can help me in anyway or give me some tips or tricks or advice or anythind please do …

Master Minds

have you try to give the focus back to the form on wich the box is when you don’t draw, and give it back when you what to draw?

Originally posted by Gorg:
have you try to give the focus back to the form on wich the box is when you don’t draw, and give it back when you what to draw?

Yes i did but nothing … Perhaps there is an other way of doing that … Can you tell me how i can access the (x,y) position of the mouse in an event who do not as it as a parameter for exemple the GetFocus(there is no parameter) event if i wanted to access the mouse position within a function like how could i do that ???

Thanks for reponding …

What I’ve been thinking by saying: give back the focus to the main form is that:

When your form as the focus, you use it’s mouse event to capture it’s position. When you are ready to write another frame, you just give back the focus to your “opengl box”.

Something else you could do that doesn’t need you to change the focus is to use pure win32 mouse calls like “mouse_event” wich will give you everything you need(position, modification of the position, if buttons have been pressed etc.).

in case you want to try the second option here is the declaration you have to put in your program:

Public Declare Sub mouse_event Lib “user32” Alias “mouse_event” (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

to learn how to work with the function, go to

and the check under platform SDK/win32 Api/references

then look for the mouse input fonctions and check mouse_event.

have fun!

Originally posted by Gorg:

will it be a fullscreen app?
if it will = true then msgbox “Use winapi!”

You could always use the Softoholic OpenGL control instead - see

It has all the usual form events. Hope this helps.

Also if you just want to use the Whait OpenGL OCX then you should be able to use the selection and feedback buffer to get the coords.