This project is read-only.

ScintillaNet in MDIChild destroys after Hide() - WM_DESTROY

Topics: Developer Forum, User Forum
Jul 19, 2007 at 7:51 AM
Edited Jul 19, 2007 at 7:54 AM
Good morning.

I'm using ScintillaNet in a project to present different log files. So there is a problem:
If you have a ScintillaNet Control in a Form which is used as an MDIChild in a MDIParent, the Control (or better the SciLexer.dll) is destroyed if you do Hide() / Visible = false.

I've done the following test:
  1. Create a new Project
  2. Add a Form which I use as MDIParent
  3. Add a Form where I add the ScintillaNet Control
  4. Add a Button somewhere (for example to the MDIParent) and have for this button the following code: childForm.Visible = !childForm.Visible;)
  5. Test (press the button twice)

I've added also the Microsoft Spy++ and saw, that all MDIChilds get a WM_DESTROY if they are hidden, and I think this is the reason why ScintillaNet is „destroyed“ or the unmanaged part. I've already a work around where I use the WinApi to show the Form. Unfortunately there are a few problems if you do it this way. For example you can't use Show() or Hide(). Even if you overwrite these methods, you must rewrite lot things that all events work correctly :-(. An other programmer don't really know that he has to show the form this way ... so it's not a nice thing at all.

So, does anyone have an idea? Or is it a new "Issue" for the Tracker.

Kind regards,
Gregor W.

WinAPI I use
private const int SW_HIDE = 0;
private const int SW_SHOW = 5;

[DllImport("user32", EntryPoint = "ShowWindow")]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

(so I pass the handle of the MDIChild and as nCmdShow one of the SW_* values)

I excuse my english, I haven't much experience only "school English"
Jul 19, 2007 at 8:30 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.