Click here to Skip to main content
15,893,161 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralExplorer extension dll - WM_SHUTDOWN Pin
AssemblySoft24-Nov-04 0:46
AssemblySoft24-Nov-04 0:46 
GeneralRe: Explorer extension dll - WM_SHUTDOWN Pin
Igor Vigdorchik24-Nov-04 10:00
Igor Vigdorchik24-Nov-04 10:00 
GeneralRe: Explorer extension dll - WM_SHUTDOWN Pin
AssemblySoft24-Nov-04 22:57
AssemblySoft24-Nov-04 22:57 
QuestionHow to embeded a button onto the FlexGrid Cell? Pin
bohrium23-Nov-04 23:34
bohrium23-Nov-04 23:34 
GeneralVB ActiveX into ATL project Pin
Brian Gould23-Nov-04 20:24
Brian Gould23-Nov-04 20:24 
QuestionWhich collection class to use? Pin
paulb23-Nov-04 19:02
paulb23-Nov-04 19:02 
AnswerRe: Which collection class to use? Pin
Joaquín M López Muñoz23-Nov-04 21:13
Joaquín M López Muñoz23-Nov-04 21:13 
Questionusing ATL7.0 instead of ATL3, I'm missing something but what? Pin
seriema23-Nov-04 14:05
seriema23-Nov-04 14:05 
Hello!

I've implemented IShellExtInit and IContextMenu and followed the Complete Idiots guide by Michael Dunn. But I'm using ATL7.0 and some stuff is different. Like the CComModule has been replaced. From MSDN:
"As of ATL 7.0, CComModule is obsolete: see ATL Module Classes for more details."

The wizard in VS.NET 2003 implemented CAtlDllModuleT. Everything compiles, but my class (T2TContextMenu) isn't called (I have set up breakpoints in all functions). I've checked the registry and my key is there:
HKEY_CLASSES_ROOT\.omfg\ShellEx\ContextMenuHandlers\This2That
default value = "{3E670573-EA3F-498A-8EB1-F72DA6B5D221}" as a string

The only difference I can see between my code and the tutorial is in the DllMain(). The tutorial calls _Module.Init(ObjectMap, hInstance, &LIBID_SIMPLEEXTLib); and has a Object map that includes the COM class the DLL is going to use. Mine doesn't. So my guess is that I have to pass the CLSID and maybe my classname somewhere to CAtlDllModuleT.

MSDN gave me this:
"Init and Term methods have moved into the constructors and destructors for the module classes; there is no longer a need to call Init and Term."

VS.NET created CThis2That like this:
class CThis2ThatModule : public CAtlDllModuleT< CThis2ThatModule >
{
public :
	DECLARE_LIBID(LIBID_This2ThatLib)
	DECLARE_REGISTRY_APPID_RESOURCEID(IDR_THIS2THAT, "{3E670573-EA3F-498A-8EB1-F72DA6B5D221}")
};


And CT2TContextMenu like this (I added the IShellExtInit/IContextMenu stuff):
class ATL_NO_VTABLE CT2TContextMenu : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CT2TContextMenu, &CLSID_T2TContextMenu>,
	public IDispatchImpl<IT2TContextMenu, &IID_IT2TContextMenu, &LIBID_This2ThatLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
	public IShellExtInit,
	public IContextMenu
{
public:
	CT2TContextMenu(){}

DECLARE_REGISTRY_RESOURCEID(IDR_T2TCONTEXTMENU)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CT2TContextMenu)
	COM_INTERFACE_ENTRY(IT2TContextMenu)
	COM_INTERFACE_ENTRY(IDispatch)
	COM_INTERFACE_ENTRY(IShellExtInit)
	COM_INTERFACE_ENTRY(IContextMenu)
END_COM_MAP()


	HRESULT FinalConstruct(){ return S_OK; }
	void FinalRelease() {}


public:
	// IShellExtInit
	STDMETHOD(Initialize)(LPCITEMIDLIST, LPDATAOBJECT, HKEY);

	// IContextMenu
	STDMETHOD(GetCommandString)(UINT, UINT, UINT*, LPSTR, UINT);
	STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO);
	STDMETHOD(QueryContextMenu)(HMENU, UINT, UINT, UINT, UINT);
private:
 /* members ommited for this post */
};


So... How do I pass my CT2TContextMenu COM implementation to the CAtlDllModuleT implementation (called CThis2That)?

Or is it something else? Unsure | :~

Cheers!
/JP
AnswerRe: using ATL7.0 instead of ATL3, I'm missing something but what? Pin
Robert Bielik24-Nov-04 21:02
Robert Bielik24-Nov-04 21:02 
GeneralRe: using ATL7.0 instead of ATL3, I'm missing something but what? Pin
seriema25-Nov-04 3:06
seriema25-Nov-04 3:06 
AnswerRe: using ATL7.0 instead of ATL3, I'm missing something but what? Pin
seriema25-Nov-04 14:37
seriema25-Nov-04 14:37 
Generalconverting BSTR to char* Pin
Andy H23-Nov-04 3:36
Andy H23-Nov-04 3:36 
GeneralRe: converting BSTR to char* Pin
Steve S23-Nov-04 5:27
Steve S23-Nov-04 5:27 
GeneralRe: converting BSTR to char* Pin
Andy H23-Nov-04 5:36
Andy H23-Nov-04 5:36 
GeneralRe: converting BSTR to char* Pin
peterchen23-Nov-04 14:17
peterchen23-Nov-04 14:17 
GeneralRe: converting BSTR to char* Pin
Andy H23-Nov-04 22:20
Andy H23-Nov-04 22:20 
GeneralRe: converting BSTR to char* Pin
peterchen23-Nov-04 22:37
peterchen23-Nov-04 22:37 
GeneralRe: custom allocator for one container instance Pin
Joaquín M López Muñoz22-Nov-04 9:42
Joaquín M López Muñoz22-Nov-04 9:42 
GeneralRe: custom allocator for one container instance Pin
peterchen22-Nov-04 13:04
peterchen22-Nov-04 13:04 
GeneralRe: custom allocator for one container instance Pin
Joaquín M López Muñoz22-Nov-04 21:50
Joaquín M López Muñoz22-Nov-04 21:50 
GeneralRe: custom allocator for one container instance Pin
Andrew Walker22-Nov-04 16:02
Andrew Walker22-Nov-04 16:02 
GeneralRe: custom allocator for one container instance Pin
Joaquín M López Muñoz22-Nov-04 21:57
Joaquín M López Muñoz22-Nov-04 21:57 
GeneralRe: custom allocator for one container instance Pin
peterchen22-Nov-04 23:21
peterchen22-Nov-04 23:21 
GeneralRe: custom allocator for one container instance Pin
Joaquín M López Muñoz22-Nov-04 23:03
Joaquín M López Muñoz22-Nov-04 23:03 
Generalcustom allocator for one container instance Pin
peterchen22-Nov-04 8:19
peterchen22-Nov-04 8:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.