PDA

View Full Version : Send a Cancel Signal to VisBuildCmd from an app


onurcivi
06-28-2006, 11:32 AM
Hi,

I have a web application that allows internal users to view available build projects (all .bld files in a specific folder) and request builds. When a user requests a build, this web application invokes VisBuildCmd with the /b switch. This web application doesn't use the object model at all, it just calls the VisBuildCmd with the project name.

I would like to add the option to cancel the build to the web application and I could not find an easy way of doing this. Since I am not using the object model, the Stop method of the builder object is not available to me. Only thing that is available to me in the app is the Process Id of VisBuildCmd, and I just did not want to prematurely terminate this process from my app when a user wants to cancel the build. Is there anything I can pass to the VisBuildCmd.exe process to tell it to cancel the build, can you think of any other ways of accomplishing this?

Thank you

kinook
06-28-2006, 03:09 PM
If you launch VisBuildCmd.exe via the CreateProcess [1] or related API and include the CREATE_NEW_PROCESS_GROUP flag, you could use the GenerateConsoleCtrlEvent [2] API to send it a CTRL_BREAK_EVENT. Otherwise, you would have to just terminate the process (for instance, using taskkill [3]).

[1] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp
[2] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/generateconsolectrlevent.asp
[3] http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/taskkill.mspx?mfr=true