How to Read an Active X Control?

From: Kannan (kannan_s_at_excite.com)
Date: 11/11/04


Date: 11 Nov 2004 10:25:43 -0800

My application is an MFC application but since MFC is essentially a
Object Oriented wrapper for Win32 I am taking the liberty to post my
question here. I also must confess that I am not an Active X
programmer.

Here is my problem:
I have to read a text string from a non editable TextBox in an "alien"
application. I say "alien" b'cas it is a third party application whose
source code is not available to me. The third party vendor tells me
that the non editable TextBox is implemented as an Active X Control.

The issues I have are as follows:
1. What must I do to get a handle (in MFC it would be a CWnd to the
ACTIVE X Control)?

2. I Don t believe that Spy++ lists all the Windows that I can
visually see in the target (i.e. third party) application. What are
the Windows that Spy++ will EXCLUDE in its Windows Hierarchy display.

3. Once I get a handle (in MFC - CWnd) to an Active X window I can get
the IUnknown to the Active X Control. Please let me know if this
understanding of mine is correct. The IUnknown can be obtained by any
one of the following calls:

LPUNKNOWN pUnk;
IUnknown *pi=0;
pUnk = localParentCWnd->GetControlUnknown();

If the ActiveX control is inside an ActiveX container then:
cmdTarg = (CCmdTarget *) localParentCWnd;
pUnk = cmdTarg->GetControllingUnknown();

If the ActiveX Container has native Windows controls inside it then:
HRESULT hr = AtlAxGetControl(localParentCWnd->m_hWnd,&pi);

Kannan



Relevant Pages

  • Re: How can I use C# GUI component in my MFC application.
    ... Here's some stuff I had written on this topic for my book (Extending MFC ... Using a .NET control in an MFC dialog ... we have seen how Windows Forms makes GUI development slightly easier ... BOOL Create(CWnd* pWnd, int x, int y, int cx, int cy); ...
    (microsoft.public.dotnet.languages.vc)
  • Re: MFC 7.1 als Container für .NET Controls
    ... Um ehrlich zu sein kenne ich mich mit der MFC und COM-Interop noch zu wenig aus um es zu glauben bzw. nicht zu glauben. ... Internet Explorer simply loads the Windows Forms control itself and treats it as a COM control. ... Damit es als ActiveX in den entsprechenden Auswahldialogen diverser Anwendungen ...
    (microsoft.public.de.vc)
  • Re: MFC Migration/Integration
    ... I cross post my somewhat frustrated question on MFC ... Check Box, Edit Control, Combo Box, ... List Box, Group Box, Radio Button, Static Text, Picture Control, ... object-oriented techniques (MFC Version 8 with Windows Forms??). ...
    (microsoft.public.vc.mfc)
  • Re: WM_PAINT NON-STOP IN CUSTOM CONTROL
    ... advantages and still have the ability to create your own custom control (not ... And this is different from what MFC supports naturally in exactly what way? ... of Windows programming and still don't know how Windows works;))).. ... BeginPaint, ...
    (microsoft.public.vc.mfc)
  • Re: WMP control resizing
    ... I understand how things work re: MFC, ActiveX ... getting the WMP9 activex control in a window and playing movies etc. ... when you want to resize the control in MFC, ...
    (microsoft.public.windowsmedia.sdk)