Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. ATL7 and VS.NET2k3 wizard, completely stuck

ATL7 and VS.NET2k3 wizard, completely stuck

Scheduled Pinned Locked Moved ATL / WTL / STL
c++comcsharpvisual-studiowindows-admin
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    seriema
    wrote on last edited by
    #1

    Hi! I'm making a shell extension, adding stuff to the context menu in Windows Explorer. I can find plenty of tutorials, but everyone uses ATL3 or VC++. I've already made a shell extension using the old stuff, now I want to try using the latest. The stuff that's generated from the VS.NET 2003 ATL wizard is completely different from what I've seen. After being adviced not to use attributes (couldn't get it to work anyway) I've been trying to get the COM_MAP stuff to work, but I've not been succesfull. It generated over 10 files, but here's the main file (I think) and what I've got so far:

    /* This was all generated by VS.NET ATL wizard, I've marked the few lines I've added */
    // This2That.cpp : Implementation of DLL Exports.

    #include "stdafx.h"
    #include "resource.h"
    #include "This2That.h"
    #include <ShlObj.h> // added---------------------

    class CThis2ThatModule :
    public CAtlDllModuleT< CThis2ThatModule >,
    public IShellExtInit // added---------------------
    {
    public :
    DECLARE_LIBID(LIBID_This2ThatLib)
    DECLARE_REGISTRY_APPID_RESOURCEID(IDR_THIS2THAT, "{58F42B54-8108-44DF-8CBC-BE62D021D4D8}")

    BEGIN\_COM\_MAP(CThis2ThatModule) // added---------------------
    	COM\_INTERFACE\_ENTRY(IShellExtInit) // added---------------------
    	COM\_INTERFACE\_ENTRY\_IID(IID\_IShellExtInit, CThis2ThatModule) // added---------------------
    END\_COM\_MAP( ) // added---------------------
    
    
    // IShellExtInit
    STDMETHOD(Initialize)( LPCITEMIDLIST, IDataObject\*, HKEY ); // added---------------------
    

    };

    STDMETHODIMP CThis2ThatModule::Initialize( LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID ) { return E_NOTIMPL; } // added---------------------

    CThis2ThatModule _AtlModule;

    // DLL Entry Point
    extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
    {
    hInstance;
    return _AtlModule.DllMain(dwReason, lpReserved);
    }

    // Used to determine whether the DLL can be unloaded by OLE
    STDAPI DllCanUnloadNow(void)
    {
    return _AtlModule.DllCanUnloadNow();
    }

    // Returns a class factory to create an object of the requested type
    STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
    {
    return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
    }

    // DllRegisterServer - Adds entries to the system registry
    STDAPI DllRegisterServer(void)
    {
    // registers object, typelib and all interfaces in typelib
    HRESULT hr = _AtlModule.DllRegisterServer();
    return hr;
    }

    // DllUnregisterServer - Removes en

    M 1 Reply Last reply
    0
    • S seriema

      Hi! I'm making a shell extension, adding stuff to the context menu in Windows Explorer. I can find plenty of tutorials, but everyone uses ATL3 or VC++. I've already made a shell extension using the old stuff, now I want to try using the latest. The stuff that's generated from the VS.NET 2003 ATL wizard is completely different from what I've seen. After being adviced not to use attributes (couldn't get it to work anyway) I've been trying to get the COM_MAP stuff to work, but I've not been succesfull. It generated over 10 files, but here's the main file (I think) and what I've got so far:

      /* This was all generated by VS.NET ATL wizard, I've marked the few lines I've added */
      // This2That.cpp : Implementation of DLL Exports.

      #include "stdafx.h"
      #include "resource.h"
      #include "This2That.h"
      #include <ShlObj.h> // added---------------------

      class CThis2ThatModule :
      public CAtlDllModuleT< CThis2ThatModule >,
      public IShellExtInit // added---------------------
      {
      public :
      DECLARE_LIBID(LIBID_This2ThatLib)
      DECLARE_REGISTRY_APPID_RESOURCEID(IDR_THIS2THAT, "{58F42B54-8108-44DF-8CBC-BE62D021D4D8}")

      BEGIN\_COM\_MAP(CThis2ThatModule) // added---------------------
      	COM\_INTERFACE\_ENTRY(IShellExtInit) // added---------------------
      	COM\_INTERFACE\_ENTRY\_IID(IID\_IShellExtInit, CThis2ThatModule) // added---------------------
      END\_COM\_MAP( ) // added---------------------
      
      
      // IShellExtInit
      STDMETHOD(Initialize)( LPCITEMIDLIST, IDataObject\*, HKEY ); // added---------------------
      

      };

      STDMETHODIMP CThis2ThatModule::Initialize( LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID ) { return E_NOTIMPL; } // added---------------------

      CThis2ThatModule _AtlModule;

      // DLL Entry Point
      extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
      {
      hInstance;
      return _AtlModule.DllMain(dwReason, lpReserved);
      }

      // Used to determine whether the DLL can be unloaded by OLE
      STDAPI DllCanUnloadNow(void)
      {
      return _AtlModule.DllCanUnloadNow();
      }

      // Returns a class factory to create an object of the requested type
      STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
      {
      return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
      }

      // DllRegisterServer - Adds entries to the system registry
      STDAPI DllRegisterServer(void)
      {
      // registers object, typelib and all interfaces in typelib
      HRESULT hr = _AtlModule.DllRegisterServer();
      return hr;
      }

      // DllUnregisterServer - Removes en

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      You're adding stuff in the wrong class. You're changing the module class, which is just the global _Module object (or whatever ATL7 calls it). You need to add a new ATL object and modify that; aside from the wizard looking different, it's pretty much the same as ATL3.1. --Mike-- LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb

      S 1 Reply Last reply
      0
      • M Michael Dunn

        You're adding stuff in the wrong class. You're changing the module class, which is just the global _Module object (or whatever ATL7 calls it). You need to add a new ATL object and modify that; aside from the wizard looking different, it's pretty much the same as ATL3.1. --Mike-- LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb

        S Offline
        S Offline
        seriema
        wrote on last edited by
        #3

        Hehe I was just about to delete my post, I noticed that too. I checked out your article code and saw that there WAS two classes. I've compiled now and it worked. So I tried to do the same thing with Attributes, and it compiles too. Now the real job begins hehe... Thank you for replying. And thank you for all the very helpful articles here at CodeProject! :-D

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups