|
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?
|
|
|
|
|
Nothing happens if you lock the critical section from the same thread twice.It prevents the thread from dead lock.
But in above case calling
m_csTest.Unlock();
twice might create problem. i am not sure about this.
May be some one else will comment on it.
Regards,
Sandip.
|
|
|
|
|
Thanks for quick response. I will wait for more replies.
|
|
|
|
|
Member 3066459 wrote: 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?Confused
From MSDN:
After a thread has ownership of a critical section, it can make additional calls to EnterCriticalSection or TryEnterCriticalSection without blocking its execution. This prevents a thread from deadlocking itself while waiting for a critical section that it already owns.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
According to the docs:
http://msdn.microsoft.com/en-us/library/ms682608.aspx[^]
"A thread must call LeaveCriticalSection once for each time that it entered the critical section."
Which seems pretty clear. Even without reading them, it would be good to do a Leave for every Enter. At worst you are wasting your time. At best, it is needed.
Iain.
|
|
|
|
|
I guess only one unlock() is sufficient since it is the same critical section being requested again.
|
|
|
|
|
When call lock() its lock count will be 1. When we call again lock count will increment by 1.Hence it is necessary to call unlock() as many times you have called lock().
|
|
|
|