- Revenera Community
- :
- FlexNet Connect
- :
- FlexNet Connect Forum
- :
- Re: Download events... C++ example?
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Download events... C++ example?
I was basically wondering if anyone has some C++ code that I could look at which receive the events generated by IUpdate.
Any help would be much appreciated!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Cheers
Dean
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
//////////////////////////////////////////////////////////////////////////
// UpdateEventSink.h
#pragma once
#import "C:\Program Files\Common Files\InstallShield\UpdateService\Agent.exe" named_guids no_namespace raw_interfaces_only
// Sink class to receive update events
class CUpdateEventSink :
public IDispEventImpl<1, CUpdateEventSink, &DIID__IUpdateEvents, &LIBID_DWUpdateServiceLib, 1, 0>
{
// IUpdateEvent callback implementation
public:
void __stdcall OnDownloadBegin();
void __stdcall OnDownloadComplete(long nResult);
void __stdcall OnProgressChanged(long nBytes, long nPercent, BSTR strTransferRate, BSTR strTimeRemaining);
void __stdcall OnUpdateBegin();
void __stdcall OnUpdateComplete(long nReturnCode);
// Event sink map
BEGIN_SINK_MAP(CUpdateEventSink)
SINK_ENTRY_EX(1, DIID__IUpdateEvents, 0x1, OnDownloadBegin)
SINK_ENTRY_EX(1, DIID__IUpdateEvents, 0x2, OnProgressChanged)
SINK_ENTRY_EX(1, DIID__IUpdateEvents, 0x3, OnDownloadComplete)
SINK_ENTRY_EX(1, DIID__IUpdateEvents, 0x4, OnUpdateBegin)
SINK_ENTRY_EX(1, DIID__IUpdateEvents, 0x5, OnUpdateComplete)
END_SINK_MAP()
}
////////////////////////////////////////////////////////////////////
// example code to receive events :
// IMPORTANT : Use MTA threading if you're using a non-
/ message pump class
hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
CComPtr
// enum updates here
// Connect event sink
CUpdateEventSink* pSink = new CUpdateEventSink
HRESULT hr = pSink->DispEventAdvise(spUpdate)
// Receive events ...
// Release event sink
HRESULTS hr = pSink->DispEventUnadvise(spUpdate);
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
My question is, where DIID__IUpdateEvents, LIBID_DWUpdateServiceLib come from
where are they declared. If it has something to do with the importing of the
agent.exe then is there any other way to
declare them since im using the dispatch method to connect to agent.exe
Thanks,
GrubUser
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
![](/skins/images/D60DF682EA37BF37032955CE10F3F0BB/responsive_peak/images/icon_anonymous_message.png)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
The 3rd parameter is in reference to the dispatch ID of the event on the interface. E.g. the number 0x1 refers to the first event in the list for IUpdateEvents ( in this that's OnDownloadBegin ). The number 0x2 would refer to the 2nd method in the list, OnProgressChanged, and so-forth. The ordering of those numbers is most easily accessed by opening agent.exe using the Object Browser of Visual Studio ( or whatever tool you have's equivalent ).
More information on that ATL macro can be found here:
http://msdn.microsoft.com/en-us/library/aaxh168w(v=vs.80).aspx
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
I've followed the example in the Reference guide for downloading and installing and the example mentioned above and I'm still not able get the events to fire. I'm using FNC 11.6 and VS2005?
Any help will be greatly appreciated!!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
I don't know that there is somebody answer my answer or not. How might I characterize the third parameter in the SINK_ENTRY_EX(1, DIID__IUpdateEvents, 0x1, OnDownloadBegin) kindly in the event that somebody who might be listening notice this answer.
![](/skins/images/D60DF682EA37BF37032955CE10F3F0BB/responsive_peak/images/icon_anonymous_message.png)