locked
Best way to avoid access denied/LNK1104 errors when building shell extension? RRS feed

  • Question

  • I have an ATL project that makes a .dll for Icon overlay handlers.  When I Rebuild in Visual Studio, if Explorer is running (which it will be), I'll get:

    warning : Access to the path 'whatever' is denied    and eventually ... LINK : fatal error LNK1104: cannot open file 'whatever'

    So I figure it's Explorer that has the .dll, so I put in a Pre-Build Event to do: taskkill /F /IM explorer.exe and a Post-Build Event to do start explorer.exe.  This works, and I can rebuild the project every time, but when Explorer starts up again, it just goes to the Libraries directory, and there is no taskbar, probably because the /F made sure it won't be able to restore.  I've seen some posts on this, but nobody has an answer as to how to get the taskbar up when you restart explorer from VC++ after Explorer has been killed.  Doing this from the command line (and of course the Task Manager) seems to work fine.

    Also -- maybe stopping and restarting Explorer isn't even the best way to avoid these errors?  It seems kind of nasty to do this.

    So what's the best way to avoid these errors without having to go to the Task manager every time and stop explorer before I rebuild?

    Thanks
     

    Tuesday, July 10, 2012 8:44 PM

Answers

  • I think this is best answered by the answer to "How not to register a Shell Extension DLL automatically."  Thanks everyone for the help.

    • Marked as answer by fbs419 Thursday, July 12, 2012 7:57 PM
    Thursday, July 12, 2012 7:57 PM

All replies

  • The issue seems to be that Visual Studio via the .rgs file is registering the .dll.  It seems very convenient, but perhaps this is not the way to go?  Maybe pre build step to unregister and post to register?
    Tuesday, July 10, 2012 11:29 PM
  • Pre build step to unregister won't work.  Even if the dll is unregistered, it remains open in Explorer.  Not sure why, but that seems like the crux of the problem. I'd like to find a better way around this than stopping explorer.
    Wednesday, July 11, 2012 12:57 PM
  • Hi fbs419, you have written a dll that need registered; so when re-build, maybe you should unregistered manually. Maybe it is by vs design... 

    Please not forget mark your answer, and unmark your disagreed point.

    • Marked as answer by fbs419 Thursday, July 12, 2012 7:55 PM
    • Unmarked as answer by fbs419 Thursday, July 12, 2012 7:55 PM
    • Proposed as answer by Elegentin XieModerator Friday, July 13, 2012 1:47 AM
    Thursday, July 12, 2012 7:04 AM
  • I think this is best answered by the answer to "How not to register a Shell Extension DLL automatically."  Thanks everyone for the help.

    • Marked as answer by fbs419 Thursday, July 12, 2012 7:57 PM
    Thursday, July 12, 2012 7:57 PM