Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Detecting thread launch in other program
#1
Hi -

What I'm looking for might be impossible but I'll ask to make sure Big Grin

I'm using QM to issue SendMessage commands for selection, text inserts, and text formatting to a third party app which uses a rich text editing control. It works just fine with one big exception: if I modify certain text the third party app launches an internal thread to perform updates which cause another thread to timeout - which causes the app to crash. It doesn't happen that often and it doesn't happen for all users - but it's nasty when it does occur.

The text in the control has more internal structure than the rich text control knows about via the standard API. I don't have access to this structure. But if I modify text that overlaps the 'fields' in the structure a thread is spawned that will cause the crash.

The stack trace in the crashed app includes the following:
Quote:at System.Windows.Forms.TextBoxBase.WmReflectCommand(Message& m)
at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
at System.Windows.Forms.RichTextBox.WmReflectCommand(Message& m)
at System.Windows.Forms.RichTextBox.WndProc(Message& m)
at Nuance.Radiology.Controls.RichTextBoxTemplate.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

What I'm hoping for - is there a way from QM to detect this event when it occurs? For debugging purposes I want to find out what triggers this event and then avoids that action. I just need to passively detect that the event has happened.

I see from ProcessMonitor that I can get a stack trace when a thread is created. If I have the names of the routines from my crash - can I create an event filter in QM so that I know when these occur?

Thanks.
#2
Create a dll and inject it into that process. When creating a new thread, Windows calls your function DllMain.
http://msdn.microsoft.com/en-us/library ... 85%29.aspx

QM does not create dlls. It is possible only with __Tcc class, in C language. Better use Visual Studio etc.

Another way - Thread32First and related functions. But in this case it probably cannot be used.

Maybe more ways exist.


Forum Jump:


Users browsing this thread: 1 Guest(s)