Board index » off-topic » Usage of the function SysExec
Geert Vancompernolle
Delphi Developer |
Usage of the function SysExec2006-05-08 02:09:23 PM off-topic19 Hi, I'm currently trying to make something that should help me in building my different targets. I've created a new menu with the corresponding submenus (popup menus which have again submenus). I've done this via "Tools | Customize | Menu". Now I have the structure and that works fine (I see my new menu item, I see my popup menus on second level and I see my submenus on 3rd level, of course with nothing "connected" to it yet). Then I created an API macro via "Tools | API Macros...". It's currently a very simple one, one which I've connected to one of the submenus of my newly created menu. The name of the API macro is "Build", the name of the function is "build", with two parameters (will be used later to select the correct popup and submenu). Here's the body of it: int build( int Type, int Level ) { int errornumber; switch( Type ) { case 0: errornumber = SysExec( "T:\\Slash30\\ceinfra\nhsw\start.bat a", "cmd", 0 ); MsgMessage( "Error number " + errornumber ); break; case 1: //MsgMessage( "Selected case1" + Type ); break; default: //MsgMessage( "Selected default " + Type ); break; } return ( 1 ); } The intention is to call a batch file that does the "real" job, whenever I select one of the submenus. In the code above, I would like to call my batch file via the SysExec() lib call, when "case 0" is selected (depending on one of the incoming paramaters). However, that doesn't work. The only thing that happens, is a DOS shell which is opened and which stays open. My batch file itself isn't called (batch file has an additional parameter, here "a", to invoke it on different entries). What I would like, is the batch file that starts and the output that is returned in the Output window of CodeWright itself. About the same behaviour as if you would do this via "Project | Project Properties | Tools | Build". It would also be nice to be able to use the options which you can select when using the build via the project settings (things such as "Use VDOS", "Redirect Output", "Save all files",... What do I have to give as parameters to the SysExec() function to achieve this? Or are there alternatives to reach the same goal? Thanks in advance for the help. Best rgds, --Geert |