Displaying ActiveX control in modeless dialog
- From: svattom@xxxxxxxxxx
- Date: 9 Feb 2006 15:00:57 -0800
First, let me start by saying that I am a Java programmer, so
MFC/Windows programming is a little foreign to me.
I have an image capture device that is controlled by an ActiveX
control, and I need to integrate this into a Java application. The
control can display a live video feed from the device, and fires events
at various times (i.e. when an image is captured). What I would like to
do is:
1. Create the ActiveX control.
2. Connect to the device to get and set properties without displaying
the control.
3. Present some options to the user (in the Java app) based on
information gathered from the device.
4. Display the control to show the video.
5. When an image is captured, return the image to Java and hide the
control. The Java app will perform some additional processing on the
image.
6. Repeat steps 4-5 for additional images.
7. Disconect from the device and destroy the control.
To do this, I have created a dialog class (derived from CDialog) to
host the control. If I make it a modeless dialog (construct, call
Create, then call ShowWindow), I don't receive any events from the
device when an image is captured. The scanner beeps when and image is
captured, so I know that part works, but I don't get the event. Also,
when I mouse over the control, the cursor turns to an hourglass.
If I make it a modal dialog, I cannot interact with the control until I
call DoModal, but I want to do so before displaying it. For testing
purposes, I tried changing my dialog to be initially visible and I
called Create, then called DoModal later. I got an assertion failure as
expected, but the control was visible (from when I called Create), and
when an image was captured, I got the event, even though the assertion
message was on screen.
I suppose I could create a modeless dialog without displying it, just
to get the info I need for steps 2-3 above, then for steps 4-5 I could
create a new modal dialog each time. However, initializing the device
takes a few seconds, so doing this repeatedly will make the process
seem slow for the user, especially since they usually capture 10-15
images at a time.
How can I get this to work properly? Could I use something other than
CDialog? Could I programmatically create the ActiveX control and drop
it into some other window if I have its HWND? Currently I am using the
Visual Studio dialog editor and class wizard to create my dialog. Any
help would be appreciated.
.
- Follow-Ups:
- Prev by Date: Re: Client-Server already-installed detection
- Next by Date: Re: Windows XP x64 MFC application problem
- Previous by thread: a command to enable all breakpoints
- Next by thread: Re: Displaying ActiveX control in modeless dialog
- Index(es):
Relevant Pages
|