Help Me Please!!!!!!!!!

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;)


Last edited on
I believe that you would be able to use it via asystem("skm.bat");

~maingeek.
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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// 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 :)

Hope it helps.

Last edited on
Topic archived. No new replies allowed.