> Hi all,
>
[quoted text clipped - 12 lines]
> same dir dll and dll_new, how could I do in one step: delete dll and
> rename dll_new with dll?
In both cases, you can't. Depending on what operating system you're
running you may be able to rename or move the file and copy a new file with
the old file name, but the running programs will continue to use the old
file until the programs are restarted.

Signature
-GJC [MS Windows SDK MVP]
-Software Consultant (Embedded systems and Real Time Controls)
- http://www.mvps.org/ArcaneIncantations/consulting.htm
-gchanson@mvps.org
Hi,
"MoveFileEx" function is to be used for this purpose.
I've been using it to replace system dll by older-versioned dlls that were
working better and that windows didn't want to replace due to higher version
number !
have a look at this msdn article Q140570 too :
http://support.microsoft.com/default.aspx?scid=kb;en-us;140570
regards,
arno
> Hi all,
>
[quoted text clipped - 15 lines]
> Thanks in advance,
> Viv
Hi Viviana,
MoveFileEx MOVEFILE_DELAY_UNTIL_REBOOT
Does this help with question 2?
Best regards,
Slobodan
> Hi all,
>
[quoted text clipped - 15 lines]
> Thanks in advance,
> Viv
Viviana Vc - 14 Jun 2004 11:49 GMT
Yes it does. Thx!
Looks like the following:
MoveFileEx(szDstFile, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
MoveFileEx(szSrcFile, szDstFile, MOVEFILE_DELAY_UNTIL_REBOOT);
would make the trick of: deleting the old dll and renaming the new dll
as the old one, all of them over a reboot, as those dlls are used by a
lot of application and even by the system so they can be done only over
a reboot.
Viv
>Hi Viviana,
>
[quoted text clipped - 24 lines]
>> Thanks in advance,
>> Viv
>Hi all,
>
[quoted text clipped - 4 lines]
>how could this be done programmatically. Is something like this
>possible? And if yes, how?
Not directly. But you can have an auxiliary program that stops your
main program, replaces it, and restarts it.
>2) My product has a dll that is used by multimple application from the
>system. Is there any way in which I could update this dll (without
>killing all the exe that have loaded this dll)? Or this is doable only
>over a reboot?
How about renaming the old DLL, copying in (or renaming) the
replacement, and letting each program start using the new version
whenever it restarted?
If you have a list of programs that you want to coerce, you could
close and restart them.
>If it's only over a reboot, how could I do the following: i have in the
>same dir dll and dll_new, how could I do in one step: delete dll and
>rename dll_new with dll?
>
>Thanks in advance,
>Viv
-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com
Viviana Vc - 14 Jun 2004 12:02 GMT
>>Hi all,
>>
[quoted text clipped - 7 lines]
>Not directly. But you can have an auxiliary program that stops your
>main program, replaces it, and restarts it.
Yes, already thought about this being the only way out ...
>>2) My product has a dll that is used by multimple application from the
>>system. Is there any way in which I could update this dll (without
[quoted text clipped - 4 lines]
>replacement, and letting each program start using the new version
>whenever it restarted?
Upss, I didn't know that I could rename a dll that is already loaded by
some applications! Because I couldn't replace it I thought that also
renaming will fail. Seems not. And the same if for the running exes.
But in the dll case, as I don't know all the app that have loaded it, so
I can not restart only those, I will need a reboot anyhow, so I could
also use the MoveFileEx right?
>If you have a list of programs that you want to coerce, you could
>close and restart them.
[quoted text clipped - 14 lines]
>Boston, MA 02118
>www.penfact.com
r_z_aret@pen_fact.com - 16 Jun 2004 16:48 GMT
clip
>>>2) My product has a dll that is used by multimple application from the
>>>system. Is there any way in which I could update this dll (without
[quoted text clipped - 11 lines]
>I can not restart only those, I will need a reboot anyhow, so I could
>also use the MoveFileEx right?
Rename is a special case of Move. I use MoveFile, not MoveFileEx. And
not for anything tricky. So I'm quite sure you're getting better info
about MoveFileEx in another set of responses.
-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com
Hi Viviana,
MoveFileEx MOVEFILE_DELAY_UNTIL_REBOOT
Does this help with question 2?
Best regards,
Slobodan
PS:
Sorry if this is second time that I post this but I can't see my yesterdays post.
> Hi all,
>
[quoted text clipped - 15 lines]
> Thanks in advance,
> Viv