|
You could try experimenting with SHFileOperation() setting the wFunc member to FO_DELETE and NOT including FOF_NORECURSION in the fFlags member. I have used it to delete all files in a folder in one operation but havent actually tried the recursive delete that is implied by the FOF_NORECURSION flag.
|
|
|
|
|
|
Please Note: _rmdir The directory must be empty, and it must not be the current working directory or the root directory.
|
|
|
|
|
http://www.codeproject.com/shell/cshellfileop.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hello to all,
in my project i am uploading the files on a server,now i want one pop up dialog box having message "Starting Uploading Process" which will appear when i will click on button "Upload" and then that dialog box should get vanished automatically after 2-3 seconds and then actual uploading process should get started means that dialog box should not have "Ok/Cancel" buttons, it should get vanished automatically after 2-3 seconds rather than get vanished after clicking on "Ok" or "cancel" button, how this can be done? can anybody help me plz?
Thanks & Regards,
Anay
|
|
|
|
|
Sounds like you'll need a dialog box and a timer. Are you using MFC?
|
|
|
|
|
yes josh i am using MFC, can u tell me how it can be done?
Anay
|
|
|
|
|
AnayKulkarni wrote: can u tell me how it can be done?
Not off the top of my head. You'll need a dialog that starts a timer when its created and closes itself when the timer fires. I'm sure you can find all that in google or even here in various articles
|
|
|
|
|
You can use of CDialog and set Timer for it with SetTimer .
|
|
|
|
|
simple,
do like this.
1.in your upload button,before your actual code, create a thread.
2.in that thread, show up your dialog containing "starting uploading process".
3.in your dialog, start onemore thread in initdialog.
4.in that thread, wait for 2 or 3 seconds and exit your new dialog.
thats it.
the above suggestions are only to give you a clue.
you have to apply some intelligence there to achieve this.
any more guidance required?,
you are welcome.
gud luck.
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
I am curious as to why you would go to the trouble of starting threads when all it needs is to call SetTimer in OnInitDialog and have a WM_TIMER handler that calls KillTimer and EndDialog when the timer event fires.
|
|
|
|
|
hai broom, may be you are right.
but i want to know weather timer is different in performance to the thread.
AFAIK timer is also a sort of a thread.
in the example which i have given, he can even customise his second thread, such that, it kills the dialog, after uploading is completed.
iam not sure weather it can be achieved through timer.
thanks.
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
chandu004 wrote: but i want to know weather timer is different in performance to the thread.
AFAIK timer is also a sort of a thread.
Timer performance is the same regardless of whether it is called from the primary thread or a secondary thread. A timer is NOT a thread-type object - it has no executable context. It is an object that is queued by the OS and released / signalled by the OS when the period has expired.
chandu004 wrote: in the example which i have given, he can even customise his second thread, such that, it kills the dialog, after uploading is completed.
If a simple modeless dialog is used by the main thread to indicate download in progress, the main program can then destroy the box when download is complete. This is how most progress dialogs are implemented.
Judy
|
|
|
|
|
chandu004 wrote: in the example which i have given...
Which is complete overkill, given that two additional threads were suggested. Using SetTimer() is the simplest and most practical solution.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Hi,
I need to programmatically set system folder permissions by using Active Directory Service Interfaces.For this I need ADsSecurity.dll file installed.These files are included with the software development kit (SDK) for Active Directory Service Interfaces 2.5.
Iam Unable to find the relevant link to download the dll.
Can anyone provide me the link to download?
Thanks
-- modified at 2:11 Monday 15th October, 2007
Today is a gift, that's why it is called the present.
|
|
|
|
|
like this:
1.When No.1 process reading a.txt, No.2 process read a.txt simultaneity, both read as usual.
2.When No.1 process reading a.txt, No.2 process write a.txt, No.2 process wait No.1 process read complete then write.
3.When No.1 process writting a.txt, No.2 process read a.txt, No.2 process wait No.1 process write complete then read.
4.When No.1 process writting a.txt, No.2 process write a.txt, No.2 process wait No.1 process write complete then write.
How use _locking (CRT functions) or LockFile , UnlockFile (Window API) finish above. it puzzled me someday. If somebody know, please tell me.Thanks very much.
|
|
|
|
|
use some global flags(may be two or three),
which indicate the state of the other thread.
say for example,
int process1flag=0,process2flag=0;
and make the flag 1 if it is writing and make it 2 if it is reading.
after write or read operations, reset them to 0.
observe the same in the other process and take the decission depending on the flags.
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
chandu004 wrote: which indicate the state of the other thread
He is talking about different process not different thread.
|
|
|
|
|
|
You should use some synchronization with the help of Mutex.
Check CreateMutex(), WaitForSingleObject() and ReleaseMutex() . You can find many samples in CP that uses mutex.
|
|
|
|
|
Hi all,
i am Encoding media files using WMSDK.As given in SDK Help i am using IWMEncoder interface for encoding. as part of that example
<br />
hr = pEncoder->Start();<br />
<br />
printf("When encoding stops, press a key to close the console window.");<br />
<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
while(!kbhit())<br />
_asm nop;<br />
<br />
hr = pEncoder->Stop();<br />
}<br />
i don't wants to use kbhit() and wants to complete hole file encoing process automatically.
For that we have functions put_Autostop() and get_Autostop() but there are not working properly.
So if anybody has an idea about that give plz.
|
|
|
|
|
when i do write the following:
m_pRecordset->Open("CREATE TABLE MY10151109(ID INT,Hex_Fangwei TEXT,Hex_FuYang TEXT,Hex_QingXie TEXT)",
theApp.m_pConnection.GetInterfacePtr(),
adOpenDynamic,
adLockOptimistic,
adCmdText);
it runs OK;
but when i do it like this:
CString mstr;
mstr.Format("CREATE TABLE '%s'(ID INT,Hex_Fangwei TEXT,Hex_FuYang TEXT,Hex_QingXie TEXT)",TB_Name);
m_pRecordset->Open(mstr.AllocSysString(),
theApp.m_pConnection.GetInterfacePtr(),
adOpenDynamic,
adLockOptimistic,
adCmdText);
appear runtime error
who could tell me why , and what should i do?
wuhuaiji
|
|
|
|
|
nibabug wrote: m_pRecordset->Open(mstr.AllocSysString(),
try putting mstr there and see
i.e. remove .AllocSysString().
AFAIK it should work.
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
<br />
void func()<br />
{<br />
struct SInfo SOCKINFO;<br />
SOCKINFO.pThis = this;<br />
SOCKINFO.ClientSocket = sockClient;<br />
strcpy(SOCKINFO.szClientIP, szClientIP);<br />
memset(SOCKINFO.szMessage, 0, BUFFER_SIZE);<br />
hThread = (HANDLE)_beginthreadex(NULL, 0, WorkThread, (LPVOID)&SOCKINFO, 0, NULL);<br />
}<br />
but,when WorkThread() is running,I'm worried about func() have been finished result in "struct SInfo SOCKINFO" be released.That's WorkThread() must be obtain a correct "struct SInfo SOCKINFO"?
UINT CServerSocket::WorkThread(LPVOID pParam)<br />
{<br />
struct SInfo Param;<br />
struct SInfo *lpParam = (struct SInfo*)pParam;<br />
}
-- modified at 23:16 Sunday 14th October, 2007
|
|
|
|