Click here to Skip to main content
15,892,809 members
Home / Discussions / COM
   

COM

 
GeneralRe: String Passing in COM component Pin
Jason Henderson19-Aug-02 2:53
Jason Henderson19-Aug-02 2:53 
GeneralRe: String Passing in COM component Pin
b_p_smith26-Aug-02 13:17
b_p_smith26-Aug-02 13:17 
GeneralRe: String Passing in COM component Pin
Jason Henderson26-Aug-02 17:01
Jason Henderson26-Aug-02 17:01 
GeneralRe: String Passing in COM component Pin
b_p_smith27-Aug-02 8:19
b_p_smith27-Aug-02 8:19 
GeneralGet/create application object Pin
EvanHansen18-Aug-02 21:14
EvanHansen18-Aug-02 21:14 
GeneralRe: Get/create application object Pin
Stephane Rodriguez.19-Aug-02 3:07
Stephane Rodriguez.19-Aug-02 3:07 
GeneralConnection Points Question for COM Gurus Pin
Complete Com Beginner17-Aug-02 13:05
sussComplete Com Beginner17-Aug-02 13:05 
GeneralRe: Connection Points Question for COM Gurus Pin
Ernest Laurentin18-Aug-02 17:06
Ernest Laurentin18-Aug-02 17:06 
Method 1:
Are you trying to catch the ActiveX-event? if yes, Visual Studio already allows you to intercept any event, you can use class wizard to do so. For each ActiveX control that you put on a dialog, you can select the event that you want to handle.

Method 2:
Now if you want to do that with C++ code (let's say MFC! is that okay?)
Follow these steps, we will create a 'proxy' class
1) Create a new class - derive from CCmdTarget and choose 'Automation' radio button
2) In the .cpp file, you need to replace the following with correct GUID of your object event.
static const IID IID_IMyevents =
{ 0x84946703, 0x496a, 0x40dd, { 0xb2, 0xb2, 0xb4, 0xe6, 0xa6, 0x60, 0x3d, 0x57 } };

3) Now you can add the event manually that you wish to handle, go again to class Wizard
and under the 'Automation' tab, you need to add the event handler like it is defined for your object. Let say, your event is: HRESULT MyEvent(short sEvent),
Add MyEvent in the name field and sEvent in the parameter list, and click 'OK' Smile | :)
Your .cpp file should look like this:
BEGIN_DISPATCH_MAP(CMyevents, CCmdTarget)
	//{{AFX_DISPATCH_MAP(CMyevents)
	DISP_FUNCTION(CMyevents, "MyEvent", MyEvent, VT_EMPTY, VTS_I2)
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()
// ....
void CMyevents::MyEvent(short uEvent) 
{
	// TODO: Add your dispatch handler code here
}

4) Create an instance of this class and call CmdTarget::GetInterface(&IID_IUnknown)
to get pointer of this object.
5) Call AtlAdvise(m_pYourObjectPtr, pEventUnknownPtr, DIID__IIDYourEvents, &m_dwAdvise);
6) Call AtlUnadvise(m_pYourObjectPtr, DIID__IIDYourEvents, m_dwAdvise) to disconnect this event handler (WM_DESTROY or other places)

The dialog method is simpler as you can see. Complete C++ solution can be a lot more complicated. You still have to create ways to communicate with your 'Frame' or 'Dialog'.
Good luck!

VOTD: 27 "All things have been committed to me by my Father. No one knows the Son except the Father,
and no one knows the Father except the Son and those to whom the Son chooses to reveal him."
- Mat 11:27(NIV)


GeneralRe: Connection Points Question for COM Gurus Pin
Todd Smith27-Aug-02 20:40
Todd Smith27-Aug-02 20:40 
Generaldiscarding smart pointers Pin
Jason Henderson16-Aug-02 10:44
Jason Henderson16-Aug-02 10:44 
GeneralRe: discarding smart pointers Pin
Ernest Laurentin18-Aug-02 17:14
Ernest Laurentin18-Aug-02 17:14 
GeneralRe: discarding smart pointers Pin
Jason Henderson19-Aug-02 2:44
Jason Henderson19-Aug-02 2:44 
GeneralCOM Object for sending ZIP file over internet Pin
abhinarulkar16-Aug-02 3:11
abhinarulkar16-Aug-02 3:11 
GeneralRe: COM Object for sending ZIP file over internet Pin
Stephane Rodriguez.18-Aug-02 2:40
Stephane Rodriguez.18-Aug-02 2:40 
GeneralRe: COM Object for sending ZIP file over internet Pin
Amit Dey27-Aug-02 12:12
Amit Dey27-Aug-02 12:12 
GeneralRe: COM Object for sending ZIP file over internet Pin
Todd Smith27-Aug-02 20:37
Todd Smith27-Aug-02 20:37 
GeneralDLL Linker error Pin
suresh_sathya15-Aug-02 23:20
suresh_sathya15-Aug-02 23:20 
GeneralRe: DLL Linker error Pin
Stephane Rodriguez.16-Aug-02 2:07
Stephane Rodriguez.16-Aug-02 2:07 
GeneralDll Loading Clarification Pin
Muhammad Nauman Khan15-Aug-02 20:44
Muhammad Nauman Khan15-Aug-02 20:44 
GeneralCOM Usage Pin
abhinarulkar15-Aug-02 19:05
abhinarulkar15-Aug-02 19:05 
GeneralRe: COM Usage Pin
Paul M Watt15-Aug-02 20:05
mentorPaul M Watt15-Aug-02 20:05 
GeneralRe: COM Usage Pin
abhinarulkar16-Aug-02 1:20
abhinarulkar16-Aug-02 1:20 
GeneralRe: COM Usage Pin
Stephane Rodriguez.15-Aug-02 20:44
Stephane Rodriguez.15-Aug-02 20:44 
GeneralCOM+ Alternatives in .NET Pin
Steve Severance15-Aug-02 13:10
Steve Severance15-Aug-02 13:10 
GeneralRe: COM+ Alternatives in .NET Pin
Stephane Rodriguez.15-Aug-02 20:58
Stephane Rodriguez.15-Aug-02 20:58 

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.