Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

KillTimer sometimes not working

jim_cox
Beginner
1,656 Views
I have a dialog with an edit box. The edit box shows elapsed time and is updated by a Timer Proc

The edit box also allows for user override - DlgSetSub is used to kill the Timer when the box gains focus - the user can then enter data in the field. The user then writes the data and dismisses the dialog - which resets the timer

And this works very well initially

But after a while (the time is variable) The KillTimer fails - returning false with GetLastError also returning 0. And then the edit box is still being updated and the data entry is not possible.

So, any ideas why KillTimer would fail?

If its any help the code is pretty simple, and optimization is disabled, and linked with the multithread libraries.

Thankx for any help you can give

Jim


0 Kudos
2 Replies
Paul_Curtis
Valued Contributor I
1,656 Views
Quoting - jim.cox
...The user then writes the data and dismisses the dialog - which resets the timer

And this works very well initially

But after a while (the time is variable) The KillTimer fails - returning false with GetLastError also returning 0. And then the edit box is still being updated and the data entry is not possible.

Hard to tell without seeing your code, but KillTimer requires the same window handle and timer id arguments as were used in SetTimer, and the hwnd is presumably that of the dialog's parent window (?) since when the dialog "is dismissed" its handle is no longer valid; perhaps your code somehow allows the handle validity to get out of sync. I will assure you that there is no problem with KillTimer, and F90 optimization and multithread libraries have no effect on Win32 API functions. Note that all handles in F90 should be declared INTEGER(HANDLE). Also, be sure to invoke the SAVE intrinsic in your dialog procs.
0 Kudos
jim_cox
Beginner
1,656 Views
Quoting - Paul Curtis

Hard to tell without seeing your code, but KillTimer requires the same window handle and timer id arguments as were used in SetTimer, and the hwnd is presumably that of the dialog's parent window (?) since when the dialog "is dismissed" its handle is no longer valid; perhaps your code somehow allows the handle validity to get out of sync.

I will assure you that there is no problem with KillTimer, and F90 optimization and multithread libraries have no effect on Win32 API functions.

Note that all handles in F90 should be declared INTEGER(HANDLE). Also, be sure to invoke the SAVE intrinsic in your dialog procs.


Thanks for the comments Paul

The dialog"dismisseal" is just SW_SHOWMINIMIZED - se I hope we are not losing the handle

It was not so much optimisation as thread timing I was thinking of - as I say it starts out working fine...

I'll check the definitions and I'll give that SAVE a try

Cheers

Jim
.
0 Kudos
Reply