PDA

View Full Version : Access violation error, when select an item of menu



10-03-2004, 05:48 PM
Hi all,

I am trying to use menu in Glut library in Delphi. I've created the menus in following ways:

procedure right_menu(id:integer); stdcall;
begin
exit;
end;
...
glutCreateMenu(right_menu);
glutAddMenuEntry('quit',1);
glutAttachMenu(GLUT_RIGHT_BUTTON);

When I right click, the menu appears. But, when I select the item, the program crashes with an 'Access Violation' error. Can anyone tell me, what is wrong here?

Any help, tip, suggestion will be greatly appreciated.

Silkut
10-04-2004, 01:59 AM
An error fueled by an access violation maybe issued by many craps in your code IMHO, personnally I verify all the 'pointeurs' (flag in english ???) that I use beacause they came from bad 'pointeurs' manipulation, or window setup declaration, it's a huge problem when you don't make your code to debug it easily !

I know my answer is not very complete concerning your prob but maybe another guy tell more about that

Anyway good luck, and take care to your 'pointeurs' ;)

Hey look at Sulaco webpage (http://sulaco.co.za)

A5H
10-04-2004, 08:03 AM
I'd guess it might be a problem in the code called by the menu system. What does that look like?

10-05-2004, 04:03 AM
Thanks for reply. I can say there is no problem with my code. Just, let's take such a easy situation like given in example. There is no pointer is used. Procedure calls just only EXIT function. Even it can be empty. And the integration between menu and event function is done integrally by Glut. I just connected them by command glutCreateMenu(right_menu). So, what can you recommend me to do?

procedure right_menu(id:integer); stdcall;
begin
exit;
end;
...
glutCreateMenu(right_menu);
glutAddMenuEntry('quit',1);
glutAttachMenu(GLUT_RIGHT_BUTTON);

10-11-2004, 04:25 PM
I solved my problem. Problem was just with the GLUT library I had. I found another version from the internet and the error is gone away.

10-11-2004, 04:26 PM
Hi all,

I solved my problem. Problem was just with the GLUT library I had. I found another version from the internet and the error is gone away.