Microsoft Developer Network > Forenhomepage > Visual C++ General > Building a DLL with VC++ 2008 Express SP1 works, but I *have* to regsvr32 it manually -- won't work from within VC.
Stellen Sie eine FrageStellen Sie eine Frage
 

FrageBuilding a DLL with VC++ 2008 Express SP1 works, but I *have* to regsvr32 it manually -- won't work from within VC.

  • Sonntag, 8. November 2009 10:31_Rej_ TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     
    Hi.. I sure hope this is the right forum...

    Building a DLL with VC++ 2008 Express SP1 works, but I *have* to regsvr32 it manually -- won't work from within VC.   I've checked the Manifest settings and all is OK there.  As a matter of fact, this used to work from Windows 7 RC Ultimate 64 bit but won't work now from Windows 7 RTM (Home Premium) 64 bit.

    I *did* have to reinstall VC++ Express 2008 but perhaps I forgot something else.

    I just realized while typing that it might be related to me setting my UAC settings to max on this install.  I'll try reverting to default to see if it fixes it...  No.. settign UAC to default didn't change anything.

    So to recap.. I *used* to build this project (a dll for a visualization in WMP) and it would start WMP *with* the dll registered properly -- all this in Windows 7 RC Ultimate 64 bit.

    Now, building it works as before, *but* I need to regsvr32.exe xyz.dll manually from a CMD that I ran as an admin.  Still allows me to check up the changes, but it's a pain to have to always register it manuallly.

    Oh, and I tried starting VC++ normally & as an admin to see if it would make any differences.  No changes.

    At a loss here. :/

    Thanks for any help.

    regards,

    R
    ~Rej

Alle Antworten

  • Dienstag, 10. November 2009 07:56Nancy ShaoMSFT, ModeratorTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     

    Hi _Rej,

    I'm not sure I understanding your question clearly, if I misunderstood you, please let me know.

    If you just ask why you need to use Regsvr32  to register dll, that's beacuse Component Object Model (COM) dynamic-link library (DLL) should be registered in register, or the project can't use it.

    About dll runs fine on RC Ultimate 64 bit but fails on Home Premium 64 bit, I would suggest you use the Depends.exe tool to check whether or not all of the dependencies of your DLL are met .

    For your reference, please see: Explanation of Regsvr32 usage and error messages

    Best Regards,
    Nancy


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Dienstag, 10. November 2009 09:17_Rej_ TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     
    Hi Nancy,

    First, thanks for the reply.

    Sorry for the confusion.  English isn't my mother tongue, so I sometimes use turns of phrase that aren't as clear as they should be.

    I'll give you an example to try to make it clearer.

    Windows 7 RC with VC++ 2008 Express;  (old setup)

    I'm creating a DLL that is a visualization for Windows Media Player.   In order to test it,

    I press F5 (rebuild project and execute/debug)...
    VC++ compiles and builds my DLL,  registers this DLL  successfully, then starts Windows Media Player.
    So, when the DLL is successfully registered by the VC++ engine, I'm able to see my visualization from within the Media Player while debugging.




    Windows 7 RTM with VC++ 2008 Express; (new setup)

    I press F5 (rebuild project and execute/debug)...
    VC++ compiles and builds my DLL, *tries* to register it without returning any errors, then starts Windows Media Player. Problem is that I cannot see the visualization. 

    Why?  Because the VC++ registration process that *used* to work with the old setup, does not work anymore.  I now have to do it manually (regsvr32.exe xyz.dll) in order to see the visualization.




    To recap, here are the steps for when it used to work, and now...

    Used to work steps:
    1) Press F5                            - compile, build, register, execute WMP (Windows Media Player).

    Steps for now:
    1) Press F5                            - compile, build. (registration won't work)
    4) type regsvr32.exe xyz.dll in an elevated DOS window.
    5) Start Windows Media Player manually to check the visualization.
    6) In short, I cannot debug the .dll since I have to start WMP outside the debugger.

    Hope this is more clear that the first post :).

    Regards,

    R

    ~Rej
  • Dienstag, 10. November 2009 16:59Brian MuthMVPTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     
    For Vista and Windows 7, regsvr32.exe requires administrator privileges.

    Therefore you need to run the Visual Studio IDE as administrator. Right-click over the VS icon, select "Run as Administrator", as opposed to "Run".