Click here to Skip to main content
15,918,808 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: STL question. Pin
jbarton11-Nov-03 4:42
jbarton11-Nov-03 4:42 
Generalofstream position and >2GB files Pin
Jeremy Osner7-Nov-03 3:38
Jeremy Osner7-Nov-03 3:38 
GeneralRe: ofstream position and >2GB files Pin
Christian Graus9-Nov-03 10:17
protectorChristian Graus9-Nov-03 10:17 
GeneralRe: ofstream position and >2GB files Pin
Jeremy Osner9-Nov-03 15:50
Jeremy Osner9-Nov-03 15:50 
GeneralTrue C/C++ goodies Pin
TW7-Nov-03 2:01
TW7-Nov-03 2:01 
GeneralSome Problem in Connection Points (MultiClients) Pin
shudingbo7-Nov-03 1:47
shudingbo7-Nov-03 1:47 
QuestionWhere is <Developers Workshop to COM and ATL 3.0 >? Pin
cr9996-Nov-03 17:55
cr9996-Nov-03 17:55 
GeneralATL/WTL DLL and the CMessageLoop* pLoop Pin
bryces6-Nov-03 13:38
bryces6-Nov-03 13:38 
Hi All,

After reading Michael Dunns WTL articles I want to convert my ATL/MFC COM Dlls to ATL/WTL ones.

Building the DLL from base setting I have built a standard ATL project and then added the required WTL #includes as per the examples in Michaels articles. I have changes the CComModule to CAppModule and compiled. Everything works a treat!

I am little bit confused though an where to exactly define/create my CMessageLoop object.

Should I do this in the DLLMain function?

<br />
extern "C"<br />
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)<br />
{<br />
    if (dwReason == DLL_PROCESS_ATTACH)<br />
    {<br />
        _Module.Init(ObjectMap, hInstance, &LIBID_WTLHISTORYLib);<br />
        DisableThreadLibraryCalls(hInstance);<br />
<br />
        // register object for message filtering and idle updates<br />
        CMessageLoop* pLoop = _Module.GetMessageLoop();<br />
<br />
        ATLASSERT(pLoop != NULL);<br />
        pLoop->AddMessageFilter(this);<br />
        pLoop->AddIdleHandler(this);<br />
    }<br />
    else if (dwReason == DLL_PROCESS_DETACH)<br />
        _Module.Term();<br />
    return TRUE;    // ok<br />
}<br />


What the DLL is to do is:
Have however many classes required, each implementing whatever COM interfaces that they need too
Do there thing and return back to Calling Application.

Am I in the right ballpark or because it is a DLL each COM implemented class has its own map... like below

<br />
// CMyReport<br />
class ATL_NO_VTABLE CMyReport: <br />
	public CComObjectRootEx<CComSingleThreadModel>,<br />
	public CComCoClass<CMyReport, &CLSID_MyReport>,<br />
	public ISupportErrorInfo,<br />
	public IHistoryReport,<br />
	public ICommand<br />
{<br />
public:<br />
   CMyReport();<br />
   ~CMyReport();<br />
<br />
DECLARE_REGISTRY_RESOURCEID(IDR_MYREPORT)<br />
<br />
DECLARE_PROTECT_FINAL_CONSTRUCT()<br />
<br />
BEGIN_COM_MAP(CMyReport)<br />
	COM_INTERFACE_ENTRY(IMyReport)<br />
	COM_INTERFACE_ENTRY(ISupportErrorInfo)<br />
	COM_INTERFACE_ENTRY(ICommand)<br />
END_COM_MAP()<br />
<br />
BEGIN_CATEGORY_MAP(CMyReport)<br />
	IMPLEMENTED_CATEGORY( __uuidof(CATID_MxCommands))<br />
END_CATEGORY_MAP()<br />
<br />
// IMakeHistory<br />
public:<br />
// ICommand<br />
	STDMETHOD(get_Enabled)(VARIANT_BOOL * Enabled);<br />
	STDMETHOD(get_Checked)(VARIANT_BOOL * Checked);<br />
	STDMETHOD(get_Name)(BSTR * Name);<br />
	STDMETHOD(get_Caption)(BSTR * Caption);<br />
	STDMETHOD(get_Tooltip)(BSTR * Tooltip);<br />
	STDMETHOD(get_Message)(BSTR * Message);<br />
	STDMETHOD(get_HelpFile)(BSTR * HelpFile);<br />
	STDMETHOD(get_HelpContextID)(LONG * helpID);<br />
	STDMETHOD(get_Bitmap)(OLE_HANDLE * Bitmap);<br />
	STDMETHOD(get_Category)(BSTR * categoryName);<br />
	STDMETHOD(OnCreate)(IDispatch * hook);<br />
	STDMETHOD(OnClick)();<br />
<br />
private:<br />
//...<br />
};<br />


Thanks for your help in advance

cheers
Bryce
GeneralRe: ATL/WTL DLL and the CMessageLoop* pLoop Pin
Michael Dunn6-Nov-03 16:51
sitebuilderMichael Dunn6-Nov-03 16:51 
Generalmultithreading deque&lt;&gt; question Pin
wibbik6-Nov-03 4:41
wibbik6-Nov-03 4:41 
GeneralRe: multithreading deque&lt;&gt; question Pin
geo_m6-Nov-03 5:26
geo_m6-Nov-03 5:26 
GeneralRe: multithreading deque&lt;&gt; question Pin
valikac6-Nov-03 5:51
valikac6-Nov-03 5:51 
GeneralRe: multithreading deque&lt;&gt; question Pin
Jeff Varszegi6-Nov-03 6:47
professionalJeff Varszegi6-Nov-03 6:47 
GeneralRe: multithreading deque&lt;&gt; question Pin
wibbik6-Nov-03 20:20
wibbik6-Nov-03 20:20 
GeneralRe: multithreading deque&lt;&gt; question Pin
Giles9-Nov-03 10:55
Giles9-Nov-03 10:55 
GeneralLinker error for vtMissing Pin
nigs_krec6-Nov-03 2:32
nigs_krec6-Nov-03 2:32 
GeneralRe: Linker error for vtMissing Pin
Brian Shifrin6-Nov-03 7:47
Brian Shifrin6-Nov-03 7:47 
General&lt;vector&gt; question Pin
Steve Messer5-Nov-03 7:02
Steve Messer5-Nov-03 7:02 
GeneralRe: <vector> question Pin
John M. Drescher5-Nov-03 7:17
John M. Drescher5-Nov-03 7:17 
GeneralRe: <vector> question Pin
Steve Messer5-Nov-03 7:59
Steve Messer5-Nov-03 7:59 
GeneralRe: &lt;vector&gt; question Pin
John M. Drescher5-Nov-03 8:08
John M. Drescher5-Nov-03 8:08 
GeneralRe: &lt;vector&gt; question Pin
Steve Messer5-Nov-03 8:15
Steve Messer5-Nov-03 8:15 
GeneralConvert habdle to object pointer Pin
abhay1013-Nov-03 18:55
abhay1013-Nov-03 18:55 
GeneralRe: Convert habdle to object pointer Pin
Abhishek Srivastava3-Nov-03 22:32
Abhishek Srivastava3-Nov-03 22:32 
GeneralRe: Convert habdle to object pointer Pin
abhay1014-Nov-03 19:02
abhay1014-Nov-03 19:02 

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.