Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!uunet!panews!ibmpa.awdpa.ibm.com!mikem From: mikem@ibmpa.awdpa.ibm.com Newsgroups: comp.os.os2.programmer Subject: Re: Group Handles from .INI Files Message-ID: <1991May7.202954.18438@ibmpa.awdpa.ibm.com> Date: 7 May 91 20:29:54 GMT References: <1991May1.202601.1272@terminator.cc.umich.edu> Sender: news@ibmpa.awdpa.ibm.com (news ego) Reply-To: mikem@ibmpa.awdpa.ibm.com (Michael MacFaden) Distribution: na Organization: IBM M&S Development, Palo Alto Lines: 45 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