|
Is there a reason why you cannot run the command directly, like
system(csRunCommands);
bypassing the batch file?
|
|
|
|
|
Hi thanks for replying,
If I use system() then the command screen will reflect. I want to execute this without any black screen (by hiding the command execution).
When I try to run this .bat file by command prompt(opening cmd as administrator) like- D:\myFolder\mybat.bat then it is saying that 'b' is not recognized as an internal or external command. 'b' is the first character in my command that is written in that file.
If I am not wrong, the problem is arising due to unicode because I am writing the command in to file through my code using WriteFile function and second parameter of this function is as-
csRunCommands = _T("bcdedit /set {bootmgr} device boot > d:\\zzz1.txt");
If I make a bat file in any drive manually and write the same command there then it is getting execute well.
Please give me some solution.
thanks
|
|
|
|
|
Madan Chauhan wrote: the problem is arising due to unicode
correct. The batch file has to be in single byte ACSII encoding.
|
|
|
|
|
Could you please give me the idea that how can I write in ASCII code in to a bat file. or After writing in unicode to a bat file can I convert the matter that the bat file contain in to ASCII.
waiting.
|
|
|
|
|
You could use CStdioFile::WriteString and open the target (batch) file with the flag CFile::typeText .
|
|
|
|
|
Thanks for the suggestion.
I used it by ::
FILE *f=fopen("D:\\myBat.bat","w");
fprintf(f,"%s\n","bcdedit /set {bootmgr} device boot > d:\\zzz1.txt");
fclose(f);
And the problem resolved.
Thanks again for your support.
|
|
|
|
|
|
Can you try with WinExec instead of ShellExecute?
Regards,
Rane
|
|
|
|
|
Hi I just tried it by using WinExec but getting the same problem.
I think the problem is arising due to unicode. I am writing in to file in unicode.
Could you please tell me that how can I convert the matter of any .bat file from unicode to ASCII.
or how can I write the commands in ASCII in to bat file that I am writing in unicode this time.
thanks.
|
|
|
|
|
Madan Chauhan wrote: WriteFile(hBatFile,csRunCommands,csRunCommands.GetLength()*2,&dwReturnVal,NULL);
Why are you using a hard-coded 2 rather than sizeof(TCHAR) ?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi there,
i am currently working on a Shell Namespace extension. In order to provide it with different Icons for my different elements, i use some image-lists to store the images. Since for every folder i browse there might be several newly created images necessary, i want to delete the lists and fill them up new. But as soon as i add the call to CImageList::DeleteImageList(), the DLL cant be registered anymore.
I guess i am missing some fundamental knowledge about how to use MFC. If it helps discoverig my fault, i can also state that every time i want to open a contextmenu or pop up a dialog, i have to add the line:
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
to the calling method because otherwise they dont show.
Due to the fact that i am pretty new to MFC-programming i bet there must be some configuration-stuff that i have to do initially to solve my problems.
can anyone help me out?
thanks in advance,
Gernot
|
|
|
|
|
Maybe its also interesting, that i dont even get an error-dialog, when i try to regsvr32 my DLL, but it just doesnt register. Visual studio says
"1>Project : error PRJ0019: A tool returned an error code from "Performing Post-Build Event...""
when i try to register in Post-Build-Routine.
|
|
|
|
|
Meanwhile i dependencywalked out what is it, that fails while trying to register:
"LoadLibraryExW("C:\projekte\Namespace Extension\MyProject\Debug\MyPlugin.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: Das System hat keinen Meldungstext fr die Meldungsnummer 0x%1 in der Meldungsdatei %2 gefunden (317)."
The text means something like "the system doesnt provide a text for this error".
Unfortunately, this doesnt help me alot. Has anyone had a similar problem or any idea that might help me out? im really stuck here!
|
|
|
|
|
CImageList::DeleteImageList() calls AfxImageList_Destroy() but in doing some quick searches, I don't see the source for AfxImageList_Destroy() in my VC8 install dir. That is weird.
|
|
|
|
|
Yes, youre right. I cant find it, too.
And it seems to be exactly that call, that doesnt work anyhow. I dont know what else to do. Is there any other possibility of cleaning that up? My extension works so far, but every time i open a folder, i get more and more GDI-Objects for the explorer.exe.
|
|
|
|
|
Dear All
which Event is fired when in a multi Property page Tab control,we change from one tab to another one.
Regards
Monhi
|
|
|
|
|
TCN_SELCHANGE
Regards,
Rane
|
|
|
|
|
If this is a property sheet (not just a tab control that you're managing yourself), handle PSN_KILLACTIVE and PSN_SETACTIVE .
|
|
|
|
|
Hi All,
I created and started a thread using AfxBeginThread().
I need to kill this thread from out side of the thread,
on any event like button click.
If I can use a global variable, and according to that i can kill it in the thread.
But is it a good way of doing?
Please clarify.
Regards,
Sunil Kumar
|
|
|
|
|
(IMHO) It is a viable approach.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
do a PeekMessage() and PumpMessage() in a loop, and once the loop exits do a CloseHandle().
|
|
|
|
|
In an around Mumbai, we reply to the person who asks a question. Not to someone who's standing next to him.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Rajesh R Subramanian wrote: In an around Mumbai, we reply to the person who asks a question. Not to someone who's standing next to him. Smile
Oh you Indians, yet not experiencing MTTP ( M essage T unneling T hrough P ersons)!!!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
sunilkumar.d wrote: If I can use a global variable, and according to that i can kill it in the thread.
Remember to use the volatile keyword.
|
|
|
|
|
yeah naveen, i forgot to use volatile.
Thanks for the info.
Regards,
Sunil Kumar
|
|
|
|