|
Rajesh R Subramanian wrote: The error message is descriptive enough for me
so you read in my mind ? damned MVP
|
|
|
|
|
Madan Chauhan wrote: but it is not executing
Madan Chauhan wrote: It is returning less than 32
if it's not executing, how can it return 32 ?
maybe you just don't see the windows because of the SW_HIDE. what if you display it with SW_SHOWNORMAL ?
also, how do you check the return code ?
|
|
|
|
|
I am receiving the returning value in an integer. It is executing but giving me the error 32 "process can not access file because it is being used by another process."
|
|
|
|
|
Madan Chauhan wrote: I am receiving the returning value in an integer
show out how you're doing this man ! show your code !!!
|
|
|
|
|
CString csFilePath = _T("D:\\myFolder\\mybat.bat"); //contains the path of my bat file.
int iReturn = (int)ShellExecute(NULL,_T("Open"),csFilePath,NULL,NULL,SW_SHOWNORMAL);
In MSDN it is written that if iReturn is greater than 32 then shellexecute() is successfull and if it is less than 32 then unsuccessfull.
and I have written the error message already to you.
|
|
|
|
|
Madan Chauhan wrote: I have written the error message already to you
and so, the message doesn't talk to you ?
What it means is perfectly clear to me. maybe you should read it again
You could use Process Explorer[^] and close the handles of the applications using this file...
|
|
|
|
|
Anyway Dear sir, may be I am wrong or doing some fault in code.
My problem is only that how can I execute a batch file in vc++?
I am not concerning only in Shellexecute(), if there is any other way, please guide me.
|
|
|
|
|
Madan Chauhan wrote: My problem is only that how can I execute a batch file in vc++?
exactly the way you do !
if you had ask me to launch a .bat from my exe, I would have written the same code for sure !
Madan Chauhan wrote: I am not concerning only in Shellexecute(), if there is any other way, please guide me.
yes, there are, but i find them not as much elegant than ShellExecute(), and this cannot be the reason.
The reason is (as the error message said), that some file is being used by another process (another application. use ProcessExplorer (very lightweight) to find which is the culprit...
|
|
|
|
|
Hello toxcct Sir
I need your help.Plz help me
|
|
|
|
|
FYI[^], tox.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
i'm aware of this.
that's why I didn't answer his today's post to me...
the OP doesn't take in account the answers he got, so i stopped wasting my time and energy with him
|
|
|
|
|
Sorry sir
ok as you wish.But i always waiting for responce..
Thx's in advance
|
|
|
|
|
Thanks Sir,
My net got slow thats y I could not read your latest reply.
Now I am doing it well after closing the handle.
Thank you very much.
|
|
|
|
|
Hi toxcct
I have a error in my code.And Mr. Rajesh R Subramanian tell me that i talk to you about that problem.My problem is that .exe file is not copy and .txt file is copy.I am useing get last error then i have found Error no. 32.
The process cannot access the file because it is being used by another process.
I am useing this code
CString cs = _T("C:\\Backup\\");
cs += PathSkipRoot(strFileName);
if ( !CopyFile(strFileName, cs, TRUE))
{
DWORD dwError = GetLastError();
CString szMsg;
szMsg.Format(_T("Error number %d"), dwError);
AfxMessageBox(szMsg);
}
else
{
AfxMessageBox(_T("Success"));
}
Sir plz help me
|
|
|
|
|
You can also use of CreateProcess.
|
|
|
|
|
Hi,
I am workin on an MFC Application which is creating registry key using RegKey.Open Function.
The registry is being created in WindowsXp but does not exist for Vista
What is the problem
Thanx in Advance
Dhiraj
|
|
|
|
|
Dhiraj kumar Saini wrote: What is the problem
Vista.
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]
|
|
|
|
|
But Vista allows registries for other application such as Skype Messenger and google etc. What is the problem with my application. What is lacking in my application.
|
|
|
|
|
Dhiraj kumar Saini wrote: But Vista allows registries for other application such as Skype Messenger and google etc. What is the problem with my application. What is lacking in my application.
Your statement is baseless. No program will be allowed to create or modify registry entries if it was not run with administrative privileges.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
This has something to do with the Administrator privileges for the account that you run your application with
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Can u tell me how privileges can be changed so that the registry is created.
|
|
|
|
|
|
Thanx It seem useful.
I will try it.
|
|
|
|
|
I have created a Ribbon MDI Application and it is working fine. My problem is I am unable to reposition the frame window after restoring the frame window.What is the problem?
Ashok.R
|
|
|
|
|
Sample code is as follows:
class TestClass
{
CCriticalSection m_csTest;
void Fun1()
{
m_csTest.Lock();
Fun2();
MessageBox("In Fun1 critical section.");
m_csTest.Unlock();
}
void Fun2()
{
m_csTest.Lock();
MessageBox("In Fun2 critical section.");
m_csTest.Unlock();
}
};
I am pretty aware we should not do this. But what will be the situation? Do I need to unlock the critical section twice as shown in the code or only one time unlock is sufficient?
|
|
|
|