Re: IMailRuleClient wont work!!!

From: Michael J. Salamone [eMVP] (mikesa#at#entrek#dot#com)
Date: 04/07/04


Date: Tue, 6 Apr 2004 22:29:05 -0700

Does your DLL properly export DllRegisterServer and DllGetClassObject?

IMailRulesClient absolutely works. I've used the same code on both SP2003
and PPC2003. Works like a champ on both. Follow the sample included in the
SDK for guidelines on implementing and registering.

You can debug, too. Attach to tmail.exe before sending any messages. Your
DLL won't be loaded until a message comes in. You can have breakpoints set
in DllGetClassObject and whereever else you need.

If tmail.exe doesn't load your DLL, it's one of these reasons: 1) Your DLL
is not registered, 2) Your DLL is registered, but it not present in the
registered location (or one of its dependencies is not available), 3) Your
DLL and any dependencies are there, but returns FALSE from its DllMain, 4)
your DLL doesn't export DllGetClassObject, 4) DllGetClassObject is exported,
but fails when it's called.

So those are things you can easily verify.

Note on Smartphone, you also have to be signed with a privileged
certificate.

-- 
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com
"Anders Carlberg" <anonymous@discussions.microsoft.com> wrote in message
news:F1376F47-4A0F-408F-A6C2-FD47995081D2@microsoft.com...
> Hi,
> I have not tested IMailRuleClient on both SmartPhone 2003 and PocketPC
2003 PhoneEdition, and i dont
> get it to work..
>
> I have created a COM and registered in the device.
> Im using eVC++ 4.0, and when the console says:
> SMSTest.dll - 0 error(s), 0 warning(s)
> Downloading files
> Checking remote file: \Windows\SMSTest.dll.
> Downloading file c:\projects\smstest\armv4dbg\smstest.dll.
> Successfully registered  \Windows\SMSTest.dll  to the device
> Finished downloading.
>
> I have a messagebox in the DllRegisterServer interface in the COM, and i
do get the popdialog.. (so it's registered then?!)
> But I cant find anything that about this in the register,
>
> So i have tested manually register the COM.
> (i have also downloaded a tool (like regsrv32) running on the device, and
try use that to register the COM, but still nothing in registry.
>
> well well, maby it supose to be that way. I continue..
>
> added this..
> [HKEY_LOCAL_MACHINE\Software\Microsoft\Inbox\Svc\SMS\Rules]
>     {0ADF692D-E88D-4C07-9774-07C28232B543} = dword: 1
>
> Restarted the device.
> And test sending a SMS..  Nothing happends.. No MessageBox.  ...  Why?!
Please help me!!
>
> Im a totally newbie on eVC.. so...
>
> Cheers.
> /Anders
>
> my code :
>
> --------------------------------------SMSRule.cpp-------------------------
---------------------
> #include "stdafx.h"
> #include "SMSTest.h"
> #include "SMSRule.h"
>
> #include <windows.h>
> #include <stdlib.h>
> #include <cemapi.h>
>
>
////////////////////////////////////////////////////////////////////////////
/
> // CSMSRule
>
> HRESULT Initialize(IMsgStore *pMsgStore, MRCACCESS *pmaDesired)
> {
>
> //MessageBox(NULL, _T("Initialize"), _T("Initialize"), MB_OK);
>
>     return S_OK;
> }
>
> HRESULT ProcessMessage(IMsgStore *pMsgStore,
>                                         ULONG cbMsg,
>                                         LPENTRYID lpMsg,
>                                         ULONG cbDestFolder,
>                                         LPENTRYID lpDestFolder,
>                                         ULONG *pulEventType,
>                                         MRCHANDLED *pHandled)
> {
>
> MessageBox(NULL, _T("ProcessMessage"), _T("ProcessMessage"), MB_OK);
>
> return S_OK;
> }
> --------------------------------------------------------------------------
-----------------
> ----------------------------------SMSTest.cpp-----------------------------
-------------
> #include "stdafx.h"
> #include "resource.h"
> #include "initguid.h"
> #include "SMSTest.h"
>
> #include "SMSTest_i.c"
> #include "SMSRule.h"
>
>
> CComModule _Module;
>
> BEGIN_OBJECT_MAP(ObjectMap)
> OBJECT_ENTRY(CLSID_SMSRule, CSMSRule)
> END_OBJECT_MAP()
>
>
////////////////////////////////////////////////////////////////////////////
/
> // DLL Entry Point
>
> extern "C"
> BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID
/*lpReserved*/)
> {
> if (dwReason == DLL_PROCESS_ATTACH)
> {
> _Module.Init(ObjectMap, (HINSTANCE)hInstance);
> #ifndef UNDER_CE
> DisableThreadLibraryCalls((HINSTANCE)hInstance);
> #endif
> }
> else if (dwReason == DLL_PROCESS_DETACH)
> _Module.Term();
> return TRUE;    // ok
> }
>
>
////////////////////////////////////////////////////////////////////////////
/
> // Used to determine whether the DLL can be unloaded by OLE
>
> STDAPI DllCanUnloadNow(void)
> {
> return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
> }
>
>
////////////////////////////////////////////////////////////////////////////
/
> // Returns a class factory to create an object of the requested type
>
> STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
> {
> return _Module.GetClassObject(rclsid, riid, ppv);
> }
>
>
////////////////////////////////////////////////////////////////////////////
/
> // DllRegisterServer - Adds entries to the system registry
>
> STDAPI DllRegisterServer(void)
> {
> MessageBox(NULL, _T("DllRegisterServer"), _T("DllRegisterServer"), MB_OK);
> // registers object, typelib and all interfaces in typelib
> return S_OK;
> }
>
>
////////////////////////////////////////////////////////////////////////////
/
> // DllUnregisterServer - Removes entries from the system registry
>
> STDAPI DllUnregisterServer(void)
> {
>
> MessageBox(NULL, _T("DllUnregisterServer"), _T("DllUnregisterServer"),
MB_OK);
>
> _Module.UnregisterServer();
> return S_OK;
> }
> --------------------------------------------------------------------------
----------------------
>


Relevant Pages

  • Re: API equivillent of RegSvr32.exe ?
    ... Every COM DLL export four routines. ... are DllRegisterServer() and DllUnregisterServerwhich do what they sound ... A generic routine to register a DLL or OCX would do: ... However, if you know all the names of your DLLs and OCXs, ...
    (microsoft.public.vb.winapi)
  • Re: How to register .dll?
    ... It looks like a COM DLL so it would probably need to be registered. ... How To Register Your Custom ActiveX DLL from a Client ... I didn't know about "DllRegisterServer" and it looks useful. ...
    (microsoft.public.vb.general.discussion)
  • Re: How to register .dll?
    ... It looks like a COM DLL so it would probably need to be registered. ... How To Register Your Custom ActiveX DLL from a Client ... I didn't know about "DllRegisterServer" and it looks useful. ... The Windows system directory. ...
    (microsoft.public.vb.general.discussion)
  • RE: Registering a custom DLL after deployment - advice?
    ... Register property to vsdraCOM - and leave the output as content ... I added the dll and the tlb and set the build action to ... publishing and invoke the .bat file. ... The custom dll is for the Access ADP. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Self registering a COM dll in a VS2003 Windows setup project...
    ... Most of the Register settings extract the settings at build time and put the ... at install time. ... code in that DLL is doing something that isn't being put into the MSI file. ... I have not been able to make a customized Redemption dll ...
    (microsoft.public.dotnet.framework.setup)

Loading