The following sample code shows how to destroy the object associated with the OBJECTID of the WP_SAMPLE class, registered earlier:
#define INCL_WINWORKPLACE #include "os2.h" HOBJECT hObj; BOOL rc; { hobj = WinQueryObject( "<WP_SAMPLE>" ); if (hObj != NULLHANDLE) { /* WinQueryObject of WP_SAMPLE was successful */ rc = WinDestroyObject(hObj); if (rc) /* hObj was successfully destroyed */ else /* WinDestroyObject failed */ } else { /* WinQueryObject failed */ return; } }