LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

program restart

Hi everyone,

is there a simple way to force a restart of a program in LabWindows CVI from within the program itself (like a keyword __RESET or a special function) ? OK, there might be the chance to finish the program as usual, and do a LaunchExecutable() on the same .exe at the end, but we also want to keep the application debuggable. So, what we would need is some kind of "faken Ctrl-F12 and Shift-F5 sequence".
Maybe somebody got an idea.

Many thanks in advance.



0 Kudos
Message 1 of 3
(3,548 Views)
I've always had to invoke the process of interest as a "child" process of a parent process who's only job is to create the child and wait for it to complete.  And then restart it, in your case.

I don't know of any way to get a Win32 process to terminate and then restart itself. 

Menchar
0 Kudos
Message 2 of 3
(3,537 Views)
If you don't like the idea of a watchdog process, you should be able to use the Windows Service Manager (SCM) function to get an auto-restart on failure/termination of your process.

You have to make your process a Win32 service.  Essentially, you register your process as a service with the OS, and at that time you specify the failure/restart behavior you want.  I think you can simply have the service manager restart your process every time it terminates.  The SCM serves as your watchdog process, you don't have to create your own.

Microsoft Windows Internals, ISBN 0-7356-1917-4  has good explanation of Windows Services.  I'm not sure CVI directly supports creating processes as services, but there's no reason you can't do it for yourself.  I seem to recall that I've created services using CVI at one time or another.

Menchar
0 Kudos
Message 3 of 3
(3,529 Views)