Topics: User Forum
Jan 13, 2010 at 8:36 PM

All greetings.
I've been recently looking through the draft and found ScintillaPad. But then it crashes with an unexpected error.
Who knows what's wrong? To tell the truth, not yet looked in detail - the hand had not reached.

Jan 13, 2010 at 11:33 PM


Thanks for your feedback. Can you be more specific what error message you're getting? When a crash occurs, ScintillaPad attempts to write the error to the file "ScintillaPad.exe.log" located in the same folder as the application. If that file exists, can you please post the contents of it here?

ScintillaPad is a work in progress, but I hope that it will one day be an excellent showcase of what ScintillaNET is capable of.




Jan 14, 2010 at 4:23 AM

Good morning.

Thank you for your promptness. Here are the contents of the file:


14.01.2010 8:12:09
System.ArgumentNullException: Value cannot be null.
Parameter name: hdc
   at System.Drawing.Graphics.FromHdc(IntPtr hdc)
   at ScintillaNet.Scintilla.WmNcPaintThemeBorder(Message& m) in D:\SelfStudy\С#\ScintillaNET\Branches\3.0\ScintillaNET\Scintilla.cs:line 2178
   at ScintillaNet.Scintilla.WndProc(Message& m) in D:\SelfStudy\С#\ScintillaNET\Branches\3.0\ScintillaNET\Scintilla.cs:line 217
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Jan 14, 2010 at 4:59 AM

This is one of those "it works on my machine" situations because I can't reproduce the error (yet).

Until I figure it out though, I've commented out the source of the error. If you download changeset 63226 you should hopefully have more luck.

If you have a moment, it would also help me to know what operating system you're using, if you have themes enabled, and if you did anything out of the ordinary when you built the source or ran the application.





Jan 14, 2010 at 5:19 AM

Ok. So much better =)
In this case, within the next week I'll see id detail what went wrong.

OS: Win7 + Aero + default theme.

Thanks for help.

Jan 14, 2010 at 5:55 AM
Edited Jan 14, 2010 at 5:56 AM

Huh, I wouldn't think you'd get a ArgumentNullException  from a value type argument. Granted the c definition of null is a zero pointer but still... Oh and I did reflector it just to make sure:


if (hdc == IntPtr.Zero)
    throw new ArgumentNullException("hdc");


Jan 14, 2010 at 3:23 PM


I think I got a lead on your bug from the discussion thread linked here: It would seem that the combination of using GetDCEx in the WM_NCPAINT message on Windows 7 can lead to problems and that is exactly what we're doing in the WmNcPaintThemeBorder method on your system. Fortunately it would seem that we could call GetWindowDC instead of GetDCEx and that should solve the problem.

I've created WI 25949 to track the resolution of this bug. It will likely take me a couple days because I'm going to first load Windows 7 in a Virtual PC and see if I can duplicate the problem and the WmNcPaintThemeBorder is going to need a total rewrite to get region clipping to work with GetWindowDC.


Jan 14, 2010 at 10:19 PM


I found some time today and was able to make the change. I've tested the fix on Windows 7 myself, but thought you might want to also give it a try. If you download changeset 63255 you should get borders with theme support on Windows 7.

If you don't find any bugs related to this fix, I'll close out WI 25949.




Jan 14, 2010 at 10:40 PM


I'll have a look closer to the evening.