OCX performance problems
joso02@shb.se
Tuesday, January 07, 1997
Johan S=F6derqvist
97-01-07 15:48
Environment: VC++ 4.0, NT 3.51
Hello,
I have problem with very long loading times when displaying an OCX for =
the
first time. At first I thought that if I loaded the OCX in the InitInst=
ance
(with ::LoadLibrary("")) I would get rid of the long load=
time when the OCX was displayed. Unfortunately the display time didn't
decrease and the program still used the disk a lot before it displayed =
the
OCX. Is there anything I can do to decrease the display time? Can I pre=
load
something more because it is more acceptable to wait when the program i=
s
loading then to wait when the user chooses to display the view with the=
OCX?
I'm using an OCX in a CFormView-based view class. I've created an wrapp=
er
class with Component Gallery and I'm using the following code to displa=
y
the OCX:
void CInformationView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// ......
// Some code to determine rectControl
// ......
// The next line is very slow!
m_LimitInformation.Create("", "", WS_TABSTOP, rectControl, this,
20000);
m_LimitInformation.ShowWindow(SW_SHOW);
}
m_LimitInformation is an instance of the wrapper class.
In the wrapper class Create is overridden (I have not changed this code=
):
virtual BOOL Create(LPCTSTR lpszClassName,
LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd, UINT nID,
CCreateContext* pContext =3D NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect,
pParentWnd, nID); }
In my program I'm using two third party OCX:
Visual Components Formula One 4.0 & BitPerSeconds Graphics Server 4.5
Both are used the same way and has this performance problem.
I would be grateful if someone could give some hints.
Regards,
/Johan S=F6derqvist
=
Mike Blaszczak -- mikeblas@nwlink.com
Wednesday, January 08, 1997
[Mini-digest: 2 responses]
At 15:48 1/7/97 +0100, joso02@shb.se wrote:
>Environment: VC++ 4.0, NT 3.51
>Hello,
>I have problem with very long loading times when displaying an OCX for the
>first time. At first I thought that if I loaded the OCX in the InitInstance
>(with ::LoadLibrary("")) I would get rid of the long load
>time when the OCX was displayed. Unfortunately the display time didn't
>decrease and the program still used the disk a lot before it displayed the
>OCX. Is there anything I can do to decrease the display time?
Not really: OLE Controls have to initialize OLE, initialize a bunch of stuff
inside of MFC, and then get the control running. The first time that happens
in a process always takes a while.
You might want to examine what your control does at startup, as
well--if you have a complicated control, it could further lengthen
your perceived initialization time.
>Can I preload something more
You might want to make sure you've properly called AfxOleInit() and
AfxEnableControlContainer() in your InitInstance() implementation.
Since you've created a CWnd-derived wrapper class for your control,
you might want to create and then destroy a hidden instance of your
control sometime when you think it would be appropriate to absorb
the delay.
>because it is more acceptable to wait when the program is loading
>then [sic] to wait when the user chooses to display the view with
>the OCX?
I think that's really a matter of opinion.
.B ekiM
http://www.nwlink.com/~mikeblas/
Why does the "new" Corvette look like a 1993 RX-7?
These words are my own. I do not speak on behalf of Microsoft.
-----From: Mario Contestabile
>In my program I'm using two third party OCX:
>Visual Components Formula One 4.0 & BitPerSeconds Graphics Server 4.5
>
>Both are used the same way and has this performance problem.
I've used the Pinnacle OCX on the same platform as you, and on a P90 32MRAM
the load time was negligible. Perhaps Visual Components is the culprit.
mcontest@universal.com
Ervin Fried -- ervinf@netcom.ca
Saturday, January 11, 1997
you may want to check the following MS KB article:
Article ID: Q148617
title: How to Speed Up Load Time of OLE Controls
http://www.microsoft.com/kb/articles/q148/6/17.htm
> Johan S=F6derqvist
> 97-01-07 15:48
>
> Environment: VC++ 4.0, NT 3.51
>
> Hello,
>
> I have problem with very long loading times when displaying an OCX for t=
he
> first time. At first I thought that if I loaded the OCX in the InitInsta=
nce
> (with ::LoadLibrary("")) I would get rid of the long load
> time when the OCX was displayed. Unfortunately the display time didn't
> decrease and the program still used the disk a lot before it displayed t=
he
> OCX. Is there anything I can do to decrease the display time? Can I prel=
oad
> something more because it is more acceptable to wait when the program is
> loading then to wait when the user chooses to display the view with the
> OCX?
>
> I'm using an OCX in a CFormView-based view class. I've created an wrappe=
r
> class with Component Gallery and I'm using the following code to display
> the OCX:
>
> void CInformationView::OnInitialUpdate()
> {
> CFormView::OnInitialUpdate();
>
> // ......
> // Some code to determine rectControl
> // ......
>
> // The next line is very slow!
> m_LimitInformation.Create("", "", WS_TABSTOP, rectControl, this,
> 20000);
> m_LimitInformation.ShowWindow(SW_SHOW);
> }
>
> m_LimitInformation is an instance of the wrapper class.
>
> In the wrapper class Create is overridden (I have not changed this code)=
:
>
> virtual BOOL Create(LPCTSTR lpszClassName,
> LPCTSTR lpszWindowName, DWORD dwStyle,
> const RECT& rect,
> CWnd* pParentWnd, UINT nID,
> CCreateContext* pContext =3D NULL)
> { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect,
> pParentWnd, nID); }
>
>
> In my program I'm using two third party OCX:
> Visual Components Formula One 4.0 & BitPerSeconds Graphics Server 4.5
>
> Both are used the same way and has this performance problem.
>
> I would be grateful if someone could give some hints.
>
> Regards,
>
> /Johan S=F6derqvist
>
>
>
>
| Вернуться в корень Архива
|