The following sample code shows how to obtain the directory specification of a given object's handle:
#define INCL_WINWORKPLACE
#include "os2.h"
HOBJECT hObject;
CHAR szPath[CCHMAXPATH + 1];
BOOL fSuccess;
hObject = WinQueryObject("<WP_OS2SYS>");
if (hObject != NULL)
{
/* WinQueryObject was successful */
fSuccess = WinQueryObjectPath(hObject,szPath,sizeof(szPath));
if (fSuccess)
{
/* WinQueryObjectPath was successful */
}
else
{
/* WinQueryObjectPath failed */
}
}
else
{
/* WinQueryObject fails */
}