BOOL GetFirstGroup( |
|
LPNEWSGROUP lpGroup |
|
); |
BOOL GetFirstGroup( |
|
LPNEWSGROUPEX lpGroup |
|
); |
The GetFirstGroup method returns information about the
first available newsgroup.
Parameters
- lpGroup
- A pointer to a NEWSGROUP or
NEWSGROUPEX structure
which will contain information about the first available
newsgroup. If the server can potentially return very large article
IDs, it is recommended that you use the NEWSGROUPEX
structure.
Return Value
If the method succeeds, the return value is non-zero. If there are
no newsgroups available, or the method fails, the return value is
zero. To get extended error information, call
GetLastError.
Remarks
The GetFirstGroup method returns information about the
first newsgroup on the server. This method is used in conjunction
with the GetNextGroup method 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
// List all available newsgroups
if (pClient->ListGroups() == NNTP_ERROR)
pClient->ShowError();
else
{
NEWSGROUP newsGroup;
BOOL bResult;
// Get each newsgroup, printing the article range and
// the name of the group
bResult = pClient->GetFirstGroup(&newsGroup);
while (bResult)
{
printf("%ld %ld %s\n", newsGroup.nFirstArticle,
newsGroup.nLastArticle,
newsGroup.szName);
bResult = pClient->GetNextGroup(&newsGroup);
}
}
Requirements
Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: csnwsv10.lib
Unicode: Implemented as Unicode and ANSI versions.
See Also
GetFirstArticle,
GetNextArticle,
GetNextGroup,
ListArticles,
ListGroups,
SelectGroup,
NEWSARTICLE,
NEWSGROUP
|