NntpGetNextGroup Function  
 
BOOL WINAPI NntpGetNextGroup(
  HCLIENT hClient,  
  LPNEWSGROUP lpGroup  
);

The NntpGetNextGroup function returns information about the next available newsgroup.

Parameters

hClient
Handle to the client session.
lpGroup
A pointer to a NEWSGROUP structure which will contain information about the next available newsgroup.

Return Value

If the function succeeds, the return value is non-zero. If there are no more newsgroups available, or the function fails, the return value is zero. To get extended error information, call NntpGetLastError.

Remarks

The NntpGetNextGroup function returns information about the next newsgroup on the server. This function is used in conjunction with the NntpGetFirstGroup function to enumerate all of the available newsgroups. Typically this is used to provide the user with a list of newsgroups to select.

While the the newsgroups are being listed, the client cannot select a newsgroup or retrieve the contents of a specific article. The client should store those newsgroups which it wants to retrieve articles from, and then once all of the newsgroups have been listed, it can then select each newsgroup and retrieve the available articles from that group.

Example

NEWSGROUP newsGroup;
BOOL bResult;
INT nResult;

// List all available newsgroups
nResult = NntpListGroups(hClient);

if (nResult == NNTP_ERROR)
{
    TCHAR szError[ASTRING];
    DWORD dwError = NntpGetLastError();
    NntpGetErrorString(dwError, szError, ASTRING);
    fprintf(stderr, "Error %08x: %s\n", dwError, szError);
    return;
}

// Get each newsgroup, printing the article range and
// the name of the group
bResult = NntpGetNextGroup(hClient, &newsGroup);
while (bResult)
{
    printf("%ld %ld %s\n", newsGroup.nFirstArticle,
                           newsGroup.nLastArticle,
                           newsGroup.szName);
    bResult = NntpGetNextGroup(hClient, &newsGroup);
}

Requirements

Client: Requires Windows 7, Windows Vista or Windows XP.
Server: Requires Windows Server 2008 or Windows Server 2003.
Header: Include cstools7.h.
Library: Use csnwsav7.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

NntpGetFirstArticle, NntpGetFirstGroup, NntpGetNextArticle, NntpListArticles, NntpListGroups, NntpListNewGroups, NntpSelectGroup, NEWSARTICLE, NEWSGROUP