Click here to Skip to main content
15,919,121 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: TranslateMessage() doesn't work ! Pin
CPallini10-Sep-08 0:42
mveCPallini10-Sep-08 0:42 
GeneralRe: TranslateMessage() doesn't work ! Pin
Joseph Marzbani10-Sep-08 0:49
Joseph Marzbani10-Sep-08 0:49 
GeneralRe: TranslateMessage() doesn't work ! Pin
Rane10-Sep-08 1:40
Rane10-Sep-08 1:40 
GeneralRe: TranslateMessage() doesn't work ! Pin
Mark Salsbery10-Sep-08 5:01
Mark Salsbery10-Sep-08 5:01 
Questionhow to control a console application Pin
eusto9-Sep-08 23:49
eusto9-Sep-08 23:49 
AnswerRe: how to control a console application Pin
sashoalm10-Sep-08 0:27
sashoalm10-Sep-08 0:27 
GeneralRe: how to control a console application Pin
eusto10-Sep-08 0:45
eusto10-Sep-08 0:45 
Questionproblem in executing .bat file Pin
Madan Chauhan9-Sep-08 23:23
Madan Chauhan9-Sep-08 23:23 
Hi all,

I am using VISTA and vc++ (using VS-2008).
In my application I am creating one .bat file using CreateFile function, after creating it I am writing three commands in to this file using WriteFile. Now I am running it by using Shellexecute() function.
The code piece is-
CString csRunCommands = _T("bcdedit /set {bootmgr} device boot > d:\\zzz1.txt");
HANDLE hBatFile = CreateFile(_T("D:\\myBat.bat"),GENERIC_READ | GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,NULL,OPEN_ALWAYS,0,NULL);
WriteFile(hBatFile,csRunCommands,csRunCommands.GetLength()*2,&dwReturnVal,NULL);
CloseHandle(hBatFile);
iReturn = (int)ShellExecute(NULL,_T("Open"),csFilePath,NULL,NULL,SW_SHOWNORMAL);

csRunCommands is a CString variable that contains the commands to be written.

All the code is running without problem. Return value of ShellExecute is 42 ie gretaer than 32 it means file is getting executed.

In the command that I am writing into file I have mention pipe that save the output in to one text file (D:\zzz1.txt). But after executing the code I am not seeing any zzz1.txt file in D:\ drive.

If I make a .bat file manually(say man.bat) and edit that by writing same command and run it as administrator then it is saving the output of command in to this text file as "The Operation completed successfully".


Please suggest me so that I can execute this .bat file by my code.


Thanks
QuestionRe: problem in executing .bat file Pin
Michael Schubert10-Sep-08 1:54
Michael Schubert10-Sep-08 1:54 
AnswerRe: problem in executing .bat file Pin
Madan Chauhan10-Sep-08 2:29
Madan Chauhan10-Sep-08 2:29 
GeneralRe: problem in executing .bat file Pin
Michael Schubert10-Sep-08 2:47
Michael Schubert10-Sep-08 2:47 
GeneralRe: problem in executing .bat file Pin
Madan Chauhan10-Sep-08 2:52
Madan Chauhan10-Sep-08 2:52 
GeneralRe: problem in executing .bat file Pin
Michael Schubert10-Sep-08 3:15
Michael Schubert10-Sep-08 3:15 
GeneralRe: problem in executing .bat file Pin
Madan Chauhan10-Sep-08 3:24
Madan Chauhan10-Sep-08 3:24 
GeneralRe: problem in executing .bat file Pin
Michael Schubert10-Sep-08 3:49
Michael Schubert10-Sep-08 3:49 
AnswerRe: problem in executing .bat file Pin
Rane10-Sep-08 2:08
Rane10-Sep-08 2:08 
GeneralRe: problem in executing .bat file Pin
Madan Chauhan10-Sep-08 3:00
Madan Chauhan10-Sep-08 3:00 
QuestionRe: problem in executing .bat file Pin
David Crow10-Sep-08 4:04
David Crow10-Sep-08 4:04 
QuestionCant register MFC-DLL when i have a call to CImageList::DeleteImageList Pin
gn0tto9-Sep-08 23:06
gn0tto9-Sep-08 23:06 
AnswerRe: Cant register MFC-DLL when i have a call to CImageList::DeleteImageList Pin
gn0tto9-Sep-08 23:25
gn0tto9-Sep-08 23:25 
AnswerRe: Cant register MFC-DLL when i have a call to CImageList::DeleteImageList Pin
gn0tto10-Sep-08 1:52
gn0tto10-Sep-08 1:52 
AnswerRe: Cant register MFC-DLL when i have a call to CImageList::DeleteImageList Pin
Michael Dunn10-Sep-08 11:42
sitebuilderMichael Dunn10-Sep-08 11:42 
GeneralRe: Cant register MFC-DLL when i have a call to CImageList::DeleteImageList Pin
gn0tto10-Sep-08 23:05
gn0tto10-Sep-08 23:05 
Questionabout tab control Pin
DSPCottage9-Sep-08 22:22
DSPCottage9-Sep-08 22:22 
AnswerRe: about tab control Pin
Rane9-Sep-08 22:58
Rane9-Sep-08 22:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.