Hi HTML control developers:
I have this problem with Html control in Pocket PC 2003 and found a work
around. I just want to post so other developers may avoid wasting time
debugging.
I hope MS mobile team will fix it in next OS update as well (if my theory is
true).
Symptoms:
In Pocket PC 2003:
Sending DTM_ADDTEXT with zero terminated ascii string to a HTML control
from a different thread. The application may crash/hange after
DTM_ENDOFSOURCE
is sent. Some time it crash/hange sooner after DTM_ADDTEXT is sent.
The same code works just fine if change to DTM_ADDTEXTW (with unicode str),
or if the message sender and HTML control in the same thread. Also there is
no such problem
in Pocket PC 2000 or 2002.
Fix:
After tens of hours debugging, finally I tried to add 2 or 3 zero to
terminate the
string being sent in DTM_ADDTEXT, it magically fix the problem.
Guessing:
I think that HTML control responds to DTM_ADDTEXT by duplicate the string
and keep the copy locally to process later, then return to the calling
thread immediately. The problem is that HTML control duplicate the ascii
string as an unicode string. So if you have only one zero at the end, there
are
chances that the string being duplicated is too long, and the process will
corrupt memory space.
Agree or not, but I completly fixed the crashing problem in my app with the
trick.
Cheers,
-Minh