NntpListArticles
INT NntpListArticles(
HCLIENT hClient,  
LONG nFirstArticle,  
LONG nLastArticle  
);

The NntpListArticles function returns a list of articles in the currently selected newsgroup, within the specified article range.

Parameters

hClient
Handle to the client session.
nFirstArticle
The first newsgroup article to be returned in the list. If this value is -1, the list will begin with the first available article in the newsgroup.
nLastArticle
The last newsgroup article to be returned in the list. If the value is -1, the list will end with the last available article in the newsgroup.

Return Value

If the function succeeds, the return value is the server result code. If the function fails, the return value is NNTP_ERROR. To get extended error information, call NntpGetLastError.

Remarks

It is possible that there will be gaps in the articles within the range of the first and last articles in the newsgroup. This may be due to a message being canceled or expired. Use the NntpGetFirstArticle and NntpGetNextArticle functions to read the list of articles returned by the server.

Example

NEWSARTICLE newsArticle;
BOOL bResult;
INT nResult;

// List all articles in the current group
nResult = NntpListArticles(hClient, -1L, -1L);

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 article in the current newsgroup, printing the article
// number and the subject of the article
bResult = NntpGetNextArticle(hClient, &newsArticle);
while (bResult)
{
    printf("%ld %s %s\n", newsArticle.nArticleId, newsArticle.szSubject);
    bResult = NntpGetNextArticle(hClient, &newsArticle);
}

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

NntpGetArticleRange, NntpGetCurrentArticle, NntpGetFirstArticle, NntpGetNextArticle, NntpListGroups, NntpListNewGroups


Copyright © 2008 Catalyst Development Corporation. All rights reserved.