DllUnregisterServer

G

Guest

Hello everyone,


I asked a related question about when DllRegisterServer is called and my
question is answered. Now I am thinking that when DllUnregisterServer will be
called?

It is reasonable to understand that during installation process or when we
set Register Output to Yes in Visual Studio 2005, during build process of
Visual Studio 2005 regsvr32.exe will invoke DllRegisterServer to put the
related registration entries to Windows Registry.

But when (what operation) will trigger DllUnregisterServer be invoked in
Visual Studio 2005?


thanks in advance,
George
 
F

Frank Hickman

George said:
Hello everyone,


I asked a related question about when DllRegisterServer is called and my
question is answered. Now I am thinking that when DllUnregisterServer will
be
called?

It is reasonable to understand that during installation process or when we
set Register Output to Yes in Visual Studio 2005, during build process of
Visual Studio 2005 regsvr32.exe will invoke DllRegisterServer to put the
related registration entries to Windows Registry.

But when (what operation) will trigger DllUnregisterServer be invoked in
Visual Studio 2005?


thanks in advance,
George

regsvr32.exe has a switch to unregister a DLL.

--
============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.
 
G

Guest

Thanks Frank,


Sorry that maybe I have not made myself understood. My question is not
regsvr32 will trigger DllUnregisterServer, but how and when Visual Studio
2005 will trigger regsvr32 (or DllUnregisterServer).

Because I think Visual Studio 2005 could use Register Output option to
trigger regsvr32, and then finally trigger DllRegisterServer, and Visual
Studio 2005 must have some methods to trigger DllUnregisterServer as well.

Any comments?


regards,
George
 
B

Ben Voigt [C++ MVP]

George said:
Thanks Frank,


Sorry that maybe I have not made myself understood. My question is not
regsvr32 will trigger DllUnregisterServer, but how and when Visual Studio
2005 will trigger regsvr32 (or DllUnregisterServer).

Because I think Visual Studio 2005 could use Register Output option to
trigger regsvr32, and then finally trigger DllRegisterServer, and Visual
Studio 2005 must have some methods to trigger DllUnregisterServer as well.

Dll(Un)RegisterServer is not designed for Visual Studio!

It is designed for an installer/uninstaller.

When you are in the early stages of your project, you might not have an
installer, so Visual Studio gives you the option to register your dll.
There is no option to unregister your dll, though you can do it yourself
using the regsvr32 tool and the /u option.
 
A

adebaene

Thanks Frank,

Sorry that maybe I have not made myself understood. My question is not
regsvr32 will trigger DllUnregisterServer, but how and when Visual Studio
2005 will trigger regsvr32 (or DllUnregisterServer).

Because I think Visual Studio 2005 could use Register Output option to
trigger regsvr32, and then finally trigger DllRegisterServer, and Visual
Studio 2005 must have some methods to trigger DllUnregisterServer as well.
What will be the usefullness of a DllUnregisterServer within Visual
Studio?

In a typical developement process, you iteratively build again and
again the same DLL, changing the source code between each build,
testing with or without the debugger, etc... So, each time you rebuild
the DLL, Visual Studio will invoke again DllRegisterServer, which
means the same registration information will be overwritten in the
Registry, always pointing to the same DLL location (where you build
your DLL). Unregistering the server presents no interest!

The only reason you may want to Unregister your DLL is once you're
done with the development and distribution work, and you want to get
rid of the DLL on your development machine. You can do that by hand if
you really want...

Arnaud
 
F

Frank Hickman

George said:
Thanks Frank,


Sorry that maybe I have not made myself understood. My question is not
regsvr32 will trigger DllUnregisterServer, but how and when Visual Studio
2005 will trigger regsvr32 (or DllUnregisterServer).

Because I think Visual Studio 2005 could use Register Output option to
trigger regsvr32, and then finally trigger DllRegisterServer, and Visual
Studio 2005 must have some methods to trigger DllUnregisterServer as well.

Any comments?


regards,
George

And while both of the responses from David and Arnaud above are correct, if
you have some code in the DLLUnregisterServer function that is causing you
problems, the only way I can think of for you to debug it would be to write
a small utility which is linked to your DLL and then calls regsvr32.exe with
the unregister switch. This may not work without tweaking as I have not
tried it.

If however you just want the debug version unregistered from your
development machine, you can add a post build option which looks just like
the one created by the checkbox option but uses the unregister switch.

--
============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.
 
G

Guest

Thanks Ben,


I want to confirm with you that you mean,

1. For DllRegisterServer, we could use Visual Studio 2005 Register Output
option to trigger (trigger regsvr32.exe);
2. For DllUnregisterServer, there is no option in Visual Studio 2005 to
trigger (trigger regsvr32.exe)?

Right?


regards,
George
 
G

Guest

Thanks Arnaud,


I want to confirm with you that you mean DllUnregisterServer is not
triggered by Visual Studio build or something else process, not like
DllRegisterServer which is triggered by build process.

Right?


regards,
George
 
G

Guest

Thanks Frank,


Your solutions are very practical. I thnk unlike DllRegisterServer, for
DllUnregisterServer, I have to some manual configurations or coding work. And
Visual Studio 2005 does not have something like *Unregister Output* checkbox
for me to have a straightforward click. :)


regards,
George
 
B

Ben Voigt [C++ MVP]

George said:
Thanks Ben,


I want to confirm with you that you mean,

1. For DllRegisterServer, we could use Visual Studio 2005 Register Output
option to trigger (trigger regsvr32.exe);
Yes.

2. For DllUnregisterServer, there is no option in Visual Studio 2005 to
trigger (trigger regsvr32.exe)?

Right?

There is no Yes/No option in Visual Studio to call regsvr32.exe /u, however
Visual Studio supports a "Custom Build Step" which can do that easily.
regards,
George

"Ben Voigt [C++ MVP]" wrote:
 
B

Ben Voigt [C++ MVP]

And while both of the responses from David and Arnaud above are correct,
if
you have some code in the DLLUnregisterServer function that is causing you
problems, the only way I can think of for you to debug it would be to
write a small utility which is linked to your DLL and then calls
regsvr32.exe with the unregister switch. This may not work without
tweaking as I have not tried it.

No, it's sufficient to set the debug executable to "regsvr32.exe" with a
command line of "/u ${TargetPath}" or the like
 
B

Ben Voigt [C++ MVP]

George said:
Thanks Arnaud,


I want to confirm with you that you mean DllUnregisterServer is not
triggered by Visual Studio build or something else process, not like
DllRegisterServer which is triggered by build process.

No, DllRegisterServer is triggered by install process, and
DllUnregisterServer is triggered by uninstall process.

Since often the developer wants to test the DLL immediately after build, the
build process can start the install process. There's no common case for the
developer wanting to automatically start an uninstall.
 
G

Guest

Thanks for your clarification, Ben!


regards,
George

Ben Voigt said:
George said:
Thanks Ben,


I want to confirm with you that you mean,

1. For DllRegisterServer, we could use Visual Studio 2005 Register Output
option to trigger (trigger regsvr32.exe);
Yes.

2. For DllUnregisterServer, there is no option in Visual Studio 2005 to
trigger (trigger regsvr32.exe)?

Right?

There is no Yes/No option in Visual Studio to call regsvr32.exe /u, however
Visual Studio supports a "Custom Build Step" which can do that easily.
regards,
George

"Ben Voigt [C++ MVP]" wrote:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top