POV-Ray : Newsgroups : povray.windows : Calling Povray from an other program : Calling Povray from an other program Server Time
2 Jul 2024 23:51:14 EDT (-0400)
  Calling Povray from an other program  
From: wkx
Date: 8 Aug 2002 10:45:05
Message: <web.3d528293c353cbdab4b13400@news.povray.org>
Hi all
I write a small app in VC which uses POV-Ray for Window to render some
bitmaps. Then I postprocess the Bitmaps created by POV-Ray so it is
important to wait until the rendering is complete. I achieve this by
synchronizing with POV-Ray which works fine, but it is very annoying that
you have to close all POV-Ray windows manually.

In a batch-file it worked with the parameter "/EXIT" but in my app this
parameter seems to have no effect (POV-Ray does not close when the render
is complete).

Here is a piece of code:

HANDLE hProcess;
PROCESS_INFORMATION ProcessInfo;
STARTUPINFO StartupInfo;
CString sParams;
sParams.Format("/EXIT /NR +I%s +w%d +h%d +kfi0 +kff%d -p -a", sFileName,
nSize, nSize, m_nStates-1);
FillMemory(&StartupInfo, sizeof(STARTUPINFO), 0);
StartupInfo.cb = sizeof(STARTUPINFO);
CString strPovray = m_pProperties->m_path.m_strPovray;
::CreateProcess(strPovray, strParams, NULL, NULL, true, 0, NULL, NULL,
&StartupInfo, &ProcessInfo);
hProcess = ::OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE, false,
ProcessInfo.dwProcessId);
if (::WaitForSingleObject(hProcess, 30000) == WAIT_TIMEOUT) {
  ::TerminateProcess(hProcess, 0);
}
::CloseHandle(hProcess);

Anyone?
Thanks


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.