Advertisement

06.19.2008 at 06:16AM PDT, ID: 23498685
[x]
Attachment Details

ShellExecute "open" on exception does not allow a force restart

Asked by iportu in C Programming Language, C++ Programming Language

Tags: Microsoft, windows console application, C/C++

I am writing a program which on an Unhandledexception, I want it to re-open itself again. For this I have created an exception filter:

long ProgExceptionFilter(EXCEPTION_POINTERS* p)
{
    if(p->ExceptionRecord->ExceptionCode==EXCEPTION_ACCESS_VIOLATION
    {
        TCHAR(acModule[MAX_PATH];
        GetModuleFileName(NULL, acModule, MAX_PATH);
        ShellExecute(NULL, _T("open"), acModule, NULL, NULL, SW_SHOW);
        return EXCEPTION_EXECUTE_HANDLER;
    }
    return EXCEPTION_CONTINUE_SEARCH;
}

This works but the problem is that the "restart" I had scheduled for 00:00 every day using (shutdown -r -f) no longer works because it cannot force the application with the above code to close.

Do yo have any ideas to overcome this problem?

Thank you .
Start Free Trial
[+][-]06.19.2008 at 06:31AM PDT, ID: 21821925

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.19.2008 at 07:13AM PDT, ID: 21822299

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.19.2008 at 07:32AM PDT, ID: 21822483

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.19.2008 at 08:27AM PDT, ID: 21823147

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: C Programming Language, C++ Programming Language
Tags: Microsoft, windows console application, C/C++
Sign Up Now!
Solution Provided By: jkr
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.19.2008 at 08:45AM PDT, ID: 21823381

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628