|
-
Feb 19th, 2008, 02:07 AM
#1
Thread Starter
New Member
'AddHandler' stops working
Hello,
I have a little problem.
I am using AddHandler to intercept incoming SMS messages and it works great, but once I send an sms from my app, the handler slows down. sms's get delayed to over a couple minutes each - IF they come through at all.
Why does sending an sms stop the handler? is there any way to fix this?
Thanks!
-
Feb 19th, 2008, 08:16 AM
#2
Frenzied Member
Re: 'AddHandler' stops working
Without knowing how the handler works, not a lot we can do.
Are you targeting WM5 devices or later - if so take a look at the MessageInterceptor namespace. Article here may help.
-
Feb 19th, 2008, 01:04 PM
#3
Thread Starter
New Member
Re: 'AddHandler' stops working
I appologize for the lack of information. It was late 
I am using WM6 and I used the same line of code used in that article:
Code:
AddHandler msgInterceptor.MessageReceived, AddressOf smsInterceptor_MessageReceived
However, I did not use the WithEvents statement used in that article. Is that important as well?
As for sending the SMS, I'm doing it like this:
Code:
Dim NewSMS as As New SmsMessage
NewMessage.Body = Body
NewMessage.To.Add(New Recipient(Recipient))
NewMessage.Send()
Thank you for your reply, I'll play around with certain things from that article and hopefully I can fix something here.
-
Feb 19th, 2008, 08:42 PM
#4
Re: 'AddHandler' stops working
Have you stepped through sending the message? Can you identify where the slowdown is occuring? One possibility is that you are triggering something that you didn't think you were triggering. What that would be can't be determined without looking, but you would see it when stepping through the code, as you'd start wandering through sections you never thought you were visiting. This would actually be the best thing to find, because it would be solvable. There are other possibilities that would be much more difficult, but the first step is to try to narrow down exactly where the slowdown is happening. If you find the why along the way....well, then you're just lucky.
My usual boring signature: Nothing
 
-
Feb 19th, 2008, 09:52 PM
#5
Thread Starter
New Member
Re: 'AddHandler' stops working
I will give it a shot,
but how do I step through the code that is behind the SMSMessage class and the .send procedure?
Thanks
-
Feb 20th, 2008, 01:19 PM
#6
Re: 'AddHandler' stops working
First, you pray that the pause is not within code that you didn't write. If your prayers in this matter are not answered, then post that.
The basic issue is that if you didn't write it, your task will be FAR tougher, but you need to eliminate the easier items first.
My usual boring signature: Nothing
 
-
Feb 20th, 2008, 02:52 PM
#7
Thread Starter
New Member
Re: 'AddHandler' stops working
[QUOTE=sporkster]
Code:
AddHandler msgInterceptor.MessageReceived, AddressOf smsInterceptor_MessageReceived
Code:
Dim NewSMS as As New SmsMessage
NewMessage.Body = Body
NewMessage.To.Add(New Recipient(Recipient))
NewMessage.Send()
is the only 'code' I have written so I could make sure the functionality met my requirements before I continued.
in the sub smsInterceptor_MessageReceived its as follows:
dim content as smsmessage
content = e.message
label1.text = content
I guess this is going to be a tough one for me as in this particular app I practically wrote nothing and theres still a problem 
thanks for the ongoing support so far.
-
Feb 24th, 2008, 04:38 AM
#8
Frenzied Member
Re: 'AddHandler' stops working
Hi,
does this article help at all?
-
Feb 24th, 2008, 04:42 PM
#9
Thread Starter
New Member
Re: 'AddHandler' stops working
I must be slacking in my searches!
I hadn't seen that article yet. Thank you. I'll get to reading and hopefully it will help me out.
-
Feb 25th, 2008, 01:59 AM
#10
Thread Starter
New Member
Re: 'AddHandler' stops working
It appears that I'm doing everything correctly (according to the above articles)
However, it's still having the slow down after the NewMessage.Send command. I'm beginning to wonder if there is some kind of incompatibility with this particular device (although I don't have another to test with) or Windows Mobile 6.
I have it narrowed down to the NewMessage.Send, though. Everything works up until that line.
-
Feb 26th, 2008, 02:21 AM
#11
Frenzied Member
Re: 'AddHandler' stops working
Are you disposing of the object after the send?
If you don't 'send', but receive several messages it is ok?
-
Feb 26th, 2008, 03:17 PM
#12
Thread Starter
New Member
Re: 'AddHandler' stops working
As long as I don't send, I can receive all messages sent to the device. Once I send, it slows down for about 5 full minutes - at which point I will recieve the delayed messages and all is normal until I send again.
I am not using the dispose property until application closing. I have also tried disposing then removing the handler and adding it again after sending just to see if there was some problem there, but it is clearly a problem after sending as that made no change.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|