Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!know!zaphod.mps.ohio-state.edu!sdd.hp.com!hp-pcd!hpcvlx!rodman From: rodman@hpcvlx.cv.hp.com (Steve Roderick) Newsgroups: comp.windows.x.motif Subject: Re: How does one establish a destroy function within an application? Message-ID: <110630011@hpcvlx.cv.hp.com> Date: 28 Sep 90 19:36:50 GMT References: <1990Sep13.190248.21038@media.uucp> Organization: Hewlett-Packard Co., Corvallis, OR, USA Lines: 33 OOPS, screwed up the last response! SORRY! I just solved this same problem, actually others solved it for me. topLevel = XtInitialize(); XtAddEventHandler(topLevel, StructureNotifyMask, TRUE, DestroyFunc, NULL); void DestroyFunc(w, client_datam event) Widget w; caddr_t client_data; XEvent *event; { if (event->type == WM_PROTOCOL && event->xclient.data[0] == WM_DESTROY_WINDOW) /* WE ARE GONE */; } you better verify the atom names (I'm not positive on them) WM_PROTOCOL == 33 && WM_DESTROY_WINDOW == 0x0064 (for sure) (not sure on names) may also need event->xclient.data.l[0] == 0x0064 ------ Stephen Roderick rodman@hpcvlx.cv.hp.com (I just call 'em as I see 'em) ------