How to get a CAxWindow Hosted Control to draw when the Window is Not visible 
Author Message
 How to get a CAxWindow Hosted Control to draw when the Window is Not visible

Hi,

I have a ATL Control that has a method that saves the controls current view
to a file. This works fine. When I use CAxWindow to host the control with a
window style that contains WS_VISIBLE my function saves an image of the
control just fine, (the saving is done by getting the controls dc and then
writing the dcs bmp to file). However I would like to use the control in a
server environment that will get requests and write the image out to a
client application. I don't want the window to be visible on the  server. I
thus do not include WS_VISIBLE in the windows style. My controls OnDraw
function now never fires and I get a part of my desktop as the saved image.
I do call FireViewChange on the control but my paint routine is not running.
Is there any reason for this, what chain of events does not occur when the
window is invisible. How can one force a repaint of the control.

My code looks as follows

CAxWindow2 m_Wnd;
CComPtr<IMyControl> m_MyControl;
AtlAxWinInit();

RECT rect = {0,0,400,400};

m_Wnd.Create(NULL, rect, _T("{010722C6-928D-4ACC-B93F-0D8AE090E6BC}"),
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE); // with WS_VISIBLE in the
style everything works fine

m_Wnd.QueryControl(__uuidof(IMyControl), (void**)&m_MyControl);

m_MyControl->Refresh(); // this calls FireViewChange();

m_MyControl->SaveImage(CComBSTR("c:\\MyImage.png"));

Thanks

Eugene



Sat, 25 Sep 2004 23:58:58 GMT  
 How to get a CAxWindow Hosted Control to draw when the Window is Not visible
Query the control for IViewObject, call IViewObject::Draw passing a
memory DC. ATL implementation routes this call to CComControl::OnDraw.
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:
> Hi,

> I have a ATL Control that has a method that saves the controls current
view
> to a file. This works fine. When I use CAxWindow to host the control
with a
> window style that contains WS_VISIBLE my function saves an image of
the
> control just fine, (the saving is done by getting the controls dc and
then
> writing the dcs bmp to file). However I would like to use the control
in a
> server environment that will get requests and write the image out to a
> client application. I don't want the window to be visible on the
server. I
> thus do not include WS_VISIBLE in the windows style. My controls
OnDraw
> function now never fires and I get a part of my desktop as the saved
image.
> I do call FireViewChange on the control but my paint routine is not
running.
> Is there any reason for this, what chain of events does not occur when
the
> window is invisible. How can one force a repaint of the control.

> My code looks as follows

> CAxWindow2 m_Wnd;
> CComPtr<IMyControl> m_MyControl;
> AtlAxWinInit();

> RECT rect = {0,0,400,400};

> m_Wnd.Create(NULL, rect, _T("{010722C6-928D-4ACC-B93F-0D8AE090E6BC}"),
> WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE); // with WS_VISIBLE in
the
> style everything works fine

> m_Wnd.QueryControl(__uuidof(IMyControl), (void**)&m_MyControl);

> m_MyControl->Refresh(); // this calls FireViewChange();

> m_MyControl->SaveImage(CComBSTR("c:\\MyImage.png"));

> Thanks

> Eugene



Sun, 26 Sep 2004 00:41:11 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Tabs does not work in webbrowser control hosted by CAxWindow in CAxDialogImpl

2. CAxWindow - Hosted Control's Window Handle

3. Horizontal Scrollbar of HTML Control Window not visible inside TabCtrl

4. Horizontal Scrollbar of HTML Control Window not visible inside TabCtrl

5. getting key events from inside an ActiveX control hosted in a CView

6. Satellite assemblies in Windows Forms controls hosted in IE

7. ActiveX Control not getting window in ie40pp2

8. Help with Control not getting an activated window

9. Why am I not getting correct position?

10. Why am I not getting a LIB?

11. getting topmost visible line before resizing window

12. Can toggle between visible and not visible.

 

 
Powered by phpBB® Forum Software