|
|
| BOOL
NntpGetFirstGroup(
|
|
|
HCLIENT
hClient, |
|
|
|
|
LPNEWSGROUP
lpGroup |
|
|
| );
|
The NntpGetFirstGroup function returns information about
the first available newsgroup.
Parameters
- hClient
- Handle to the client session.
- lpGroup
- A pointer to a NEWSGROUP structure
which will contain information about the first available
newsgroup.
Return Value
If the function succeeds, the return value is non-zero. If there
are no newsgroups available, or the function fails, the return
value is zero. To get extended error information, call
NntpGetLastError.
Remarks
The NntpGetFirstGroup function returns information about
the first newsgroup on the server. This function is used in
conjunction with the NntpGetNextGroup 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.
Note that if no newsgroups are returned by the server, it may
indicate that it requires the client to authenticate itself prior
to requesting a list of groups or articles.
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 = NntpGetFirstGroup(hClient, &newsGroup);
while (bResult)
{
printf("%ld %ld %s\n", newsGroup.nFirstArticle,
newsGroup.nLastArticle,
newsGroup.szName);
bResult = NntpGetNextGroup(hClient, &newsGroup);
}
Requirements
Client: Requires Windows Vista, Windows XP or Windows
2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or
Windows 2000 Server.
Header: Include cstools6.h.
Library: Use csnwsav6.lib.
Unicode: Implemented as Unicode and ANSI versions.
See Also
NntpGetFirstArticle,
NntpGetNextArticle, NntpGetNextGroup, NntpListArticles, NntpListGroups, NntpListNewGroups, NntpSelectGroup, NEWSARTICLE, NEWSGROUP
|
|