Click here to Skip to main content
15,920,217 members
Home / Discussions / COM
   

COM

 
GeneralRe: Receive events in vb from an interface returned by a method Pin
Vi24-Aug-02 20:16
Vi24-Aug-02 20:16 
GeneralComAddin and addin Pin
Gheyret4-Aug-02 18:53
Gheyret4-Aug-02 18:53 
QuestionATL Problems?? Pin
Leesen3-Aug-02 22:56
Leesen3-Aug-02 22:56 
AnswerRe: ATL Problems?? Pin
Vi24-Aug-02 20:12
Vi24-Aug-02 20:12 
QuestionHow to get CLSID for the underlying object. Pin
cagey2-Aug-02 10:04
cagey2-Aug-02 10:04 
AnswerRe: How to get CLSID for the underlying object. Pin
soptest2-Aug-02 13:17
soptest2-Aug-02 13:17 
GeneralRe: How to get CLSID for the underlying object. Pin
Gertjan Schuurmans4-Aug-02 2:55
Gertjan Schuurmans4-Aug-02 2:55 
GeneralCOM+ Remote Transient Event Subscription Pin
d2hilst2-Aug-02 3:56
d2hilst2-Aug-02 3:56 
I have written a C++ application that uses the COM+ event system. It consists of a publisher that creates log strings and

a subscriber client that creates a transient event subscription to get notifications every time a log string is sent. Everything

works fine when I run the publisher and subscriber on the same host, but if I try to subscribe from another host it fails.

The setup code looks like this:

BOOL RegisterTransientSubscription(LPCOLESTR SubscriptionName,
LPCOLESTR pszEventID,
IUnknown *pUnknown,
LPOLESTR* ppszSubscriptionID)
{
ICOMAdminCatalog* pac;
HRESULT hr = E_FAIL;
// Get an ICOMAdminCatalog interface pointer.
hr = ::CoCreateInstance (CLSID_COMAdminCatalog, NULL,
CLSCTX_SERVER,
IID_ICOMAdminCatalog,
(void**) &pac);

if (SUCCEEDED (hr))
{
ICatalogCollection* pcc = NULL;
BSTR bstr = ::SysAllocString(OLESTR \
("TransientSubscriptions"));
// host name edit empty <=> local publisher,
// otherwise remote host...
if (m_sHostName.IsEmpty())
{
// Get an ICatalogCollection pointer for the
// TransientSubscriptions collection (local).
hr = pac->GetCollection(bstr, (IDispatch**)&pcc);
::SysFreeString (bstr);
} else {
ICatalogCollection* tmp;
hr = pac->Connect(m_sHostName.AllocSysString(),
(IDispatch**)&tmp);
if (SUCCEEDED(hr))
{
VARIANT v;
VariantInit(&v);
hr = tmp->get_Name(&v);
hr = tmp->GetCollection(bstr, v,
(IDispatch**)&pcc);
tmp->Release();
}
}

if (SUCCEEDED (hr))
{
// Add an item to the TransientSubscriptions
// collection.
ICatalogObject* pco;
hr = pcc->Add((IDispatch**) &pco);

if (SUCCEEDED (hr))
{
// Register a transient subscription.
hr = SetStringProperty(pco, OLESTR("Name"),
pszSubscriptionName);
hr = SetStringProperty(pco,
OLESTR("EventCLSID"),
pszEventID);
hr = SetBoolProperty(pco, OLESTR("Enabled"),
TRUE);
hr = SetIUnknownProperty(pco, OLESTR\
("SubscriberInterface"),
pUnknown);
// Copy the subscription ID to the address
// specified by the caller.
VARIANT var;
::VariantInit (&var);
bstr = ::SysAllocString (OLESTR ("ID"));
pco->get_Value (bstr, &var);
::SysFreeString (bstr);

int nSize = (::SysStringLen(var.bstrVal) + 1) *
sizeof (OLECHAR);
BYTE* pBuffer = new BYTE[nSize];
::CopyMemory (pBuffer, var.bstrVal, nSize);
*ppszSubscriptionID = (LPOLESTR) pBuffer;

::VariantClear (&var);
pco->Release();
}

// Write the changes to the catalog.
long lResult;
hr = pcc->SaveChanges(&lResult);
pcc->Release();
}
pac->Release();
}
return (SUCCEEDED(hr)) ? TRUE : FALSE;
}

Any help would be much appreciated (2 weeks of debugging/testing/experimenting and I still don´t know what's wrong).

Regards,

Stefan
QuestionImplemented QueryStatus... but I get idl errors? Pin
Tommy Svensson2-Aug-02 0:23
Tommy Svensson2-Aug-02 0:23 
AnswerRe: Implemented QueryStatus... but I get idl errors? Pin
Vi22-Aug-02 1:22
Vi22-Aug-02 1:22 
GeneralCreating a Typelib Pin
Brigg Thorp1-Aug-02 7:13
Brigg Thorp1-Aug-02 7:13 
GeneralRe: Creating a Typelib Pin
Vi21-Aug-02 19:31
Vi21-Aug-02 19:31 
GeneralWeb Services Implementation Guide Pin
Stanford Powers31-Jul-02 18:36
sussStanford Powers31-Jul-02 18:36 
General! SPAM ! Pin
soptest1-Aug-02 7:01
soptest1-Aug-02 7:01 
QuestionNow why doesn't this COMPILE!?!?!? Pin
Tommy Svensson31-Jul-02 6:42
Tommy Svensson31-Jul-02 6:42 
AnswerRe: Now why doesn't this COMPILE!?!?!? Pin
soptest31-Jul-02 9:07
soptest31-Jul-02 9:07 
GeneralNeed a starting point Pin
yeeeooowww31-Jul-02 6:18
yeeeooowww31-Jul-02 6:18 
GeneralIDispatch:Invoke - Runtime Access Violation error when accessing DISPARARAM &dp Pin
tm31-Jul-02 5:34
tm31-Jul-02 5:34 
GeneralRe: IDispatch:Invoke - Runtime Access Violation error when accessing DISPARARAM &dp Pin
Lily1831-Jul-02 6:14
Lily1831-Jul-02 6:14 
GeneralRe: IDispatch:Invoke - Runtime Access Violation error when accessing DISPARARAM &dp Pin
tm31-Jul-02 7:35
tm31-Jul-02 7:35 
GeneralCreating a Microsoft Word plugin ! Pin
Maerlin31-Jul-02 5:00
Maerlin31-Jul-02 5:00 
GeneralRe: Creating a Microsoft Word plugin ! Pin
Anonymous31-Jul-02 8:27
Anonymous31-Jul-02 8:27 
QuestionHow to talk to IE Internet Options + misc? Pin
Tommy Svensson31-Jul-02 1:31
Tommy Svensson31-Jul-02 1:31 
QuestionHow can I define packed structure in IDL? Pin
magicast30-Jul-02 22:21
magicast30-Jul-02 22:21 
AnswerRe: How can I define packed structure in IDL? Pin
Mark Janveaux4-Aug-02 20:34
Mark Janveaux4-Aug-02 20:34 

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.