Been working a while with the Chilkat lib for IMAP. Since my test application does what I want, today I integrated the code into my mail application. Now one of the declares doesn’t want to work. I can register the lib, logging into an IMAP account also works. But getting the mailboxes simply does nothing:
[code] declare function ListMailboxes lib ImapLibLocation selector “ListMailboxes:wildcardedMailbox:” _
(obj as Ptr, refname as CFStringRef, wildcard as CFStringRef) as Ptr
dim p as Ptr = ListMailboxes(self, “”, “*”)
if p <> nil then
dim theMailboxes as new MailboxesCko(p, False)
MailboxesOriginal = theMailboxes.getMailboxes
MailboxFlags = theMailboxes.getFlags
end[/code]
In the test app p is not nil. In the main app p is nil. The code uses MacOSlib. The super of the class of the code is NSObject.
How do I find out why the declare isn’t working? I can’t see a difference in the execution compared to the test app.
@Eli: yes, the codes lives in the same class in both apps. Actually, the class is the same external item.
But I had another idea: in the test app the code is executed directly. In the main app I have the usual mess of threads and timers. I dimly remember having problems with code in threads before. Will do some testing tomorrow.
The CkoImap class has a LastErrorText property (plus a LastResponse and a LastResponseCode). These will help you debugging.
So you could try this:
dim p as Ptr = ListMailboxes(self, "", "*")
if p is nil then
MsgBox self.LastErrorText
else
dim theMailboxes as new MailboxesCko(p, False)
MailboxesOriginal = theMailboxes.getMailboxes
MailboxFlags = theMailboxes.getFlags
end