Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: How to catch the exception from timer call back function



Permlink Replies: 2 - Last Post: Apr 24, 2018 9:14 PM Last Post By: velrajan muthuvel Threads: [ Previous | Next ]
velrajan muthuvel

Posts: 28
Registered: 9/22/14
How to catch the exception from timer call back function
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 24, 2018 11:26 AM
Hi,

Please help me how to catch the exception from timer call back function?

Currently I am using the CreateTimerQueueTimer() function for triggering the timer function for specified interval.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: How to catch the exception from timer call back function
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 24, 2018 11:59 AM   in response to: velrajan muthuvel in response to: velrajan muthuvel
velrajan muthuvel wrote:

Please help me how to catch the exception from timer call back
function?

Win32 API callbacks don't generate exceptions. If you are getting an
exception, it has to be coming from your own code inside the callback.
So ust wrap the code in a try/catch or __try/__except block, depending
on the nature of the exception, and handle it as needed.

--
Remy Lebeau (TeamB)
velrajan muthuvel

Posts: 28
Registered: 9/22/14
Re: How to catch the exception from timer call back function
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 24, 2018 9:14 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Hi Remy,

Thank you for your support.

I wrapped with try/ catch block in my timer function. But when I execute the application, I got below exception

1. Frame Work.exe raised exception class $ul with message Exception Object Address: OxF9ODA88’.
2. FrameWork.exe raised exception class $TException with message Exception Object Address:
OxF9C1F2O.
3.FrameWork.exe raised exception class Exception with message ‘Messages must be shown in the main UI
thread.’.

Could you help me how to fix it.

Velrajan M


Remy Lebeau (TeamB) wrote:
velrajan muthuvel wrote:

Please help me how to catch the exception from timer call back
function?

Win32 API callbacks don't generate exceptions. If you are getting an
exception, it has to be coming from your own code inside the callback.
So ust wrap the code in a try/catch or __try/__except block, depending
on the nature of the exception, and handle it as needed.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02