Sample code for 30+ languages & platforms
Visual FoxPro

Transition from Imap.CheckForNewEmail to Imap.QueryMbx

Provides instructions for replacing deprecated CheckForNewEmail method calls with QueryMbx.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loImap
LOCAL loMsgSetObj
LOCAL lcCriteria
LOCAL lnBUid
LOCAL loMsgSet

lnSuccess = 0

loImap = CreateObject('Chilkat.Imap')

* ...
* ...

* ------------------------------------------------------------------------
* The CheckForNewEmail method is deprecated:

loMsgSetObj = loImap.CheckForNewEmail()
IF (loImap.LastMethodSuccess = 0) THEN
    ? loImap.LastErrorText
    RELEASE loImap
    CANCEL
ENDIF

* ...
* ...

RELEASE loMsgSetObj

* ------------------------------------------------------------------------
* Do the equivalent using QueryMbx.
* Your application creates a new, empty MessageSet object which is passed 
* in the last argument and filled upon success.

lcCriteria = "new-email"
lnBUid = 1

loMsgSet = CreateObject('Chilkat.MessageSet')
lnSuccess = loImap.QueryMbx(lcCriteria,lnBUid,loMsgSet)
IF (lnSuccess = 0) THEN
    ? loImap.LastErrorText
    RELEASE loImap
    RELEASE loMsgSet
    CANCEL
ENDIF

RELEASE loImap
RELEASE loMsgSet