Hi,
I use sendMessage to retrieve information from another application.
For some obscur reasons, my code work only in a button click event and
nowhere else in my application. I mean I get unexpected result
depending where the code is placed in my application ?!?!?!?!?
Here is my code:
================================
//retrieve all line in a win32 multiline textbox
IntPtr
NbOfLines=SendMessage(1050958,EM_GETLINECOUNT,IntP tr.Zero,IntPtr.Zero);
string CtrlContent="";
// MessageBox.Show("Uncomment this line and everything work....");
for (int cnt=0;cnt<(int)NbOfLines;cnt++)
{
StringBuilder textBuffer = new StringBuilder();
int NbOfChars=SendMessage(1050958,EM_GETLINE,cnt,textB uffer);
CtrlContent+=textBuffer.ToString();
}
MessageBox.Show("Content="+CtrlContent);
The preceding code placed in a button click event work
perfectly....but the same code in a TreeView afterSelect event is not
working at all, the content is always empty without any reasons...
if I put a messagebox before the loop, everything work
perfectly.....This is totally weird is anybody can explain what is
going on???
This non logic behaviour is a ***MAJOR PROBLEM*** in my application I
really need to find a way to fix this..
Thanks!