jwh@bodwin.ifs.umich.edu (Jim Howe) (05/02/91)
I've just started exploring the profile capabilities of OS/2 PM and I have a question that I hope someone can answer. Several of the Prf... calls take a group handle as a parameter. However, the only way I can find to get a group handle is to create a new group. Is there a way to get the handle to an existing group? James W. Howe internet: jwh@citi.umich.edu University of Michigan uucp: uunet!mailrus!citi.umich.edu!jwh Ann Arbor, MI 48103-4943 James W. Howe internet: jwh@citi.umich.edu University of Michigan uucp: uunet!mailrus!citi.umich.edu!jwh Ann Arbor, MI 48103-4943
mikem@ibmpa.awdpa.ibm.com (05/08/91)
In article <1991May1.202601.1272@terminator.cc.umich.edu> jwh@bodwin.ifs.umich.edu (Jim Howe) writes: >I've just started exploring the profile capabilities of OS/2 PM >and I have a question that I hope someone can answer. Several >of the Prf... calls take a group handle as a parameter. However, >the only way I can find to get a group handle is to create a >new group. Is there a way to get the handle to an existing group? > The API isn't very straigt forward..but here is what I use in a routine to locate a group handle. This code fragment enumerates all groups in the desktop manager then goes on to get the titles. len = PrfQueryProgramTitles(hini1, SGH_ROOT, (PPROGTITLE)NULL, 0, (PULONG) &count); if (!len) { fprintf(stderr, "FindGroup: PrfQueryProgramTitles() returned 0\n"); return NULL; } if (DosAllocSeg((USHORT)len+10, &sel1, SEG_GETTABLE)) { fprintf(stderr, "FindGroup: DosAllocSeg() failed!\n"); return NULL; } titleptr = (PROGTITLE *)MAKEP(sel1, 0); PrfQueryProgramTitles(hini1, SGH_ROOT, titleptr, len+9, &count); group = NULL; for (x = 0; x < (USHORT)count; x++) { pgroup = PrfCreateGroup(hini1, (PVOID)titleptr[x].pszTitle, SHE_VISIBLE| SHE_PROTECTED); if (!pgroup) continue; count1 = 0; len = PrfQueryProgramTitles(hini1, pgroup, pptitle, 0, &count1); if (len <= 0) // no programs in the group .... and so on.. See MS V4 pg 264 for details. Hope this helps you out. Michael R. MacFaden IBM Palo Alto Marketing Systems mikem@ibmpa.awdpa.ibm.com, macfaden@paloic1.vnet.ibm.com disclaimer: what I write above is not necessarily my employer's opinion