Hi! My name is Akmal.
Can somebody help me with this problem:
I have programs(skm.bat) wich works only from Command Promt
I want to create USER INTERFACE for this program.
But, I don't know how to call "skm.bat" from my Windows Application.
Please HELP!!!!!
I don't know what to so do!!!
THANK YOU!!!!
Execuse Me If You Don't Understand This Topic
My English is not Very Well;)
If I understand you correctly, the below should be what you're after?
It gives you a very rudimentary interface for "skm.bat" - it uses the system command suggested by maingeek, but runs it in a console window. This window is NOT the same as the console window you get when you compile and run code in your compiler - the following is actually WinAPI code which creates its own console window and runs the batch file therein.
// console.cpp
// This code will open a WinAPI console window in which the code
// in function "main ()" will run
// Effectively it emulates the sort of consold window which is seen
// when running non WinAPI code from any compiler
#include <windows.h>
#include <iostream.h>
#include <stdio.h>
int main(void); // Declare a main function
int WINAPI WinMain(HINSTANCE hInst,HINSTANCE hPrev,LPSTR lpszCmd,int nCmd)
{
AllocConsole( ); // Create Console Window
freopen("CONIN$","rb",stdin); // reopen stdin handle as console window input
freopen("CONOUT$","wb",stdout); // reopen stout handle as console window output
freopen("CONOUT$","wb",stderr); // reopen stderr handle as console window output
main( ); // Call a regular C main function
FreeConsole( ); // Free Console Window
return 0;
}
int main()
{
// to call a batch file (or any other system command) place it here;
// you need to add the full directory path unless the batch file
// is in the same directory as the program compiled from this code
// or (I think?) the directory is included in your PATH definition
system ("skm.bat");
system ("pause");
return 0;
}
For more information on the various functions (particularly the WinAPI code) try Google :)