Displaying 1 result from an estimated 1 matches for "cpmin".
Did you mean:
pmin
2010 Nov 20
1
CRITICAL_SECTION hang my application
...appear. So I decided to use critical section. When main thread tries to add text, the text adds perfectly, but when the second thread tries to add text - it hangs my app :( .
Here is the code in C++:
Code:
HWND__ *h_Edit = rtf_list->Handle;
EnterCriticalSection(&cr_sec);
CHARRANGE cr;
cr.cpMin = 0;
cr.cpMax = 0;
// App hangs on this line
SendMessage(h_Edit, EM_EXSETSEL, 0, (LPARAM)&cr);
//.....
LeaveCriticalSection(&cr_sec);
Before this I use:
Code:
CRITICAL_SECTION cr_sec;
InitializeCriticalSection(&cr_sec);
to initialize Critical Section.