I have a Win32 project and i want to execute an exe or BAT file from wihin the project
and I wnat the code for changing the directory from the c: to d: etc.
thanks
Printable View
I have a Win32 project and i want to execute an exe or BAT file from wihin the project
and I wnat the code for changing the directory from the c: to d: etc.
thanks
Q1 : You can use ShellExecute
Code:ShellExecute(0,"OPEN","C:\\test.bat","","",SW_NORMAL);
this didn't work
I a using VC++ 6 and
my Project is WIn32 console Aplication Project (Dos type)
Code:#include "stdafx.h"
main()
{
int x;
printf("\n");
printf("Please Make your choice\n");
printf("--------------------------\n");
printf("1- Run close-up 6.5\n\n");
printf("Or press Enter to Exit\n");
scanf("%d",&x);
if (x==1)
ShellExecute(0,"OPEN","d:\cls\crm","","",SW_NORMAL);
return 0;
}
You must include <windows.h>
Oh, its a console program. I just assumed you meant a windows app. Just add #include <windows.h> at the top.
:)
Still no Help
I don't wan to run this Applicaion from Windows
I want to make it run from dos .
I want to make it run from Autoexec.bat
I may be wrong, but I think you have to be in windows to use the windows resources. Unless it's packed in there during compilation. Not sure, though.
my Project is WIn32 console Aplication Project (Dos type)
I think we've already established that...Quote:
Originally posted by moja
my Project is WIn32 console Aplication Project (Dos type)
my friend
1- I tried to use include <windows.h> with no Help
2- I want o run my application just prior to windows staring (i.e. include it in Autoexec.bat )
so no requiremnt for windows resorces to be there.
am I right.
If it's supposed to be outside of Windows... and you're trying to use Windows.h... does that make any sense? Anyway, it looks like you're trying to create a bootloader of sorts. Autoexec.bat is called after the default bootloader, I just thought I'd let you know. And, all that you are trying to do is easily accomplished WITH a batch file. I suggest you learn them inside out... man, it was fun tweaking BAT files back in the day... :)
I think the big thing you need to realize here is something you said yourself:Quote:
Originally posted by moja
my friend
1- I tried to use include <windows.h> with no Help
2- I want o run my application just prior to windows staring (i.e. include it in Autoexec.bat )
so no requiremnt for windows resorces to be there.
am I right.
It is a Win32 Console Application. Not a DOS program.Quote:
my Project is Win32 console Aplication Project (Dos type)
Code:#include <stdlib.h>
system("c:\\myfile.bat");