Hi Experts,
I have this small piece of code that I need explained.
receiveMessages is a boolean variable.Code:Do While receiveMessages DoEvents Loop
I have a user control that embeds into an existing app via implementation of interface.
When my user control is embedded, the textbox in my user control could not respond to keyboard navigation and keyboard commands for copy and paste.
In my investigation I found out that the usercontrol form receives the keyboard commands but not the textbox. That is, the textbox does not respond to WM_KEYUP events for arrow keys and ctrl or shift keys.
Somehow the parent must be doing some stuff which I don't know.
Having the above code somewhere in my user control fixes the textbox problem.
My question is, what is DoEvents in a Loop doing?
Does it somehow retain control to my user control and not the parent form where my user control is embedded?
I really have no idea why this code is fixing the issue. Must be some underlying reason with the event handling and threading.




Reply With Quote