View Full Version : closing

01-24-2003, 05:08 PM
how would you write a program that closes when you hit a certain key, i dont care which one.

also how do you change the icon of the program

01-24-2003, 06:47 PM
void keyboard(unsigned char key, int x, int y)
case 27:

27 is acsii for escape

if using glut you would put this in your main

you question is kind of hard to answer though because you don't specify what you are writing in and also what you are using for handling events IE windows, linux, or glut .

[This message has been edited by mdog1234 (edited 01-24-2003).]

[This message has been edited by mdog1234 (edited 01-24-2003).]

01-25-2003, 05:53 PM
For the icon (this is in Windows) you have to load an icon as a resource then, when you are setting up your window class, do this:

wc.hIcon = LoadIcon(hInstance, "resource");

where "wc" is your window class, "hInstance" is the instance handle WinMain gives you, and "resource" is the name of the resource you saved the icon as. Remember that if the resource name isn't a string you have to do this:

wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(RESOURCE));

Hope that helped!