Jump to content
Software FX Community

Questions about ::CreateWnd function when using the DLL


User (Legacy)
 Share

Recommended Posts

Hi,

I am currently using chartfx's DLL to open windows that a user can

interact with dynamically. There are a couple of things that I have

noticed. I also am curious as to the timing of the window destruction of

the HWND returned by the ::CreateWnd function.

1.) I have noticed that when I enable and dock the pallettebar and

patternbars programmatically the UI menus of the toolbar don't seem to

realize that they are infact there. Example:

HRESULT hr = chart_fx->CreateWnd( (long)this->m_hWnd, 0, 0, 0, 50, 50,

WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS );

chart_fx_hwnd = (HWND)chart_fx->GethWnd();

CWND chart_wnd.Attach( chart_fx_hwnd );

chart_fx->GetPaletteBarObj()->PutVisible( VARIANT_TRUE );

chart_fx->GetPatternBarObj()->PutVisible( VARIANT_TRUE );

Once the window is opened I can see the 2 bars that I activated. If I right

click on the chart and select the toolbar, then click on the hammer-looking

icon that shows a menu at the bottom of which you can select to enable

palettebar, patternbar, etc, these 2 items are not shown as if they are

active( i.e. there is no Check mark icon next to them ).

2.) I also have been noticing exceptions being thrown when I have this

chart_fx window active. Hard for me to track down exactly how I am

producing them, but it appears to definitely have something to do with the

fact that I have enabled palette and pattern bars. If I do not have these

windows enabled I never see the error. When I do see the error it seems

like the HWND for one of the sfxbar objects is still valid and is tryin to

receive an OnPaint message even though all of its parent windows are no

longer valid. I am still tryin to figure out exactly WHY this happens. I

was curious if I need to make some call or something to that effect to make

certain that the HWND object and all child windows created therein are

cleaned up appropriately. Is it enough simple to call release on the

IChartFX* that I have? Should that destroy everything? There may indeed be

some sort of timing issue here because we use multithreads. I made certain

that creation and destruction calls for chartfx wnd occur in the same

thread. Essentially we have a main app window that has a group of

components, each component is opened in its own thread/window. While a

component window is still active with the ChartFX wnd active as well if I

close the main window/main thread that is where I begin to see the

errors/exceptions...usually seems like it is trying to send a message to one

of the toolbarobjects that has a bogus parent HWND. If I close the Chartfx

wnd first then close main app wnd everything is fine. Like I said I am not

exactly sure what is going on, still trying to figure that out, I just

thought that maybe the behavior from 1.) might be some sort of an

explanation for that. Or at the very least you could point me to where I

should look to try to resolve this problem. Thanks for your time.

-Mac

Link to comment
Share on other sites

To turn on the PaletteBar and PatternBar use the appropriate Boolean 

properties instead of:

chart_fx->GetPaletteBarObj()->PutVisible( VARIANT_TRUE );

chart_fx->GetPatternBarObj()->PutVisible( VARIANT_TRUE );

Use:

chart_fx->PutPaletteBar(TRUE);

chart_fx->PutPatternBar(TRUE);

This should solve all your problems.

As for when the hWnd is destroyed, it will be destroyed either by you

(calling DestroyWindow) or when the parent window is destroyed.

--

FP

Software FX

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...