P
pfurb
Hi.
Thanks for all suggestions.
I have finally solved the problem. The System.Windows.Forms.Timer
fails because of the UI-operations it executes in my program. So the
program crashes when it is being closed.
The solution was to replace the System.Windows.Forms.Timer with an
implementation of SetTimer and KillTimer.
Now it works fine.
....
int monitorTimer = SetTimer(this.Handle, 9999, 1000, 0);
....
/--- Set timer
[System.Runtime.InteropServices.DllImport("user32.dll")]
extern static int SetTimer(System.IntPtr hWnd,System.UInt32
iEvent,System.UInt32 iElapse, int iCallbackMustBeZero);
//--- Kill timer
[System.Runtime.InteropServices.DllImport("user32.dll")]
extern static int KillTimer(System.IntPtr hWnd,int iEvent);
//--- Timer static
static int WM_TIMER = 0x0113;
protected override void WndProc(ref Message m)
{
//--- Check if it is a timer process
if (m.Msg == WM_TIMER)
{
)
base.WndProc(ref m);
}
br/
peter
Thanks for all suggestions.
I have finally solved the problem. The System.Windows.Forms.Timer
fails because of the UI-operations it executes in my program. So the
program crashes when it is being closed.
The solution was to replace the System.Windows.Forms.Timer with an
implementation of SetTimer and KillTimer.
Now it works fine.
....
int monitorTimer = SetTimer(this.Handle, 9999, 1000, 0);
....
/--- Set timer
[System.Runtime.InteropServices.DllImport("user32.dll")]
extern static int SetTimer(System.IntPtr hWnd,System.UInt32
iEvent,System.UInt32 iElapse, int iCallbackMustBeZero);
//--- Kill timer
[System.Runtime.InteropServices.DllImport("user32.dll")]
extern static int KillTimer(System.IntPtr hWnd,int iEvent);
//--- Timer static
static int WM_TIMER = 0x0113;
protected override void WndProc(ref Message m)
{
//--- Check if it is a timer process
if (m.Msg == WM_TIMER)
{
)
base.WndProc(ref m);
}
br/
peter