The MASM Forum

Projects => Easy Code IDE 32/64-bit => Topic started by: AssemblyChallenge on February 16, 2015, 11:30:27 PM

Title: The color changing bug.
Post by: AssemblyChallenge on February 16, 2015, 11:30:27 PM
Greetings.

I find this one from time to time and figure out a possible way to generate it:

Open EasyCode, load any project.
Let it open for a very long time.
Suspend the computer for several hours.

If you are lucky, the result will be as the attached example. The only solution is to close EasyCode and reopen it.

Regards.
Title: Re: The color changing bug.
Post by: rsala on February 20, 2015, 10:05:47 AM
Hi,

Sorry for this issue and thanks for reporting it.

Please give some time to see whether I can find the bug and fix it.

Regards!
Title: Re: The color changing bug.
Post by: AssemblyChallenge on February 21, 2015, 02:12:56 AM
Thank you Ramon, and please don't be; we are only human  ;) :t

The two most interesting elements are:

* Only the background color changes, not the letters.
* So far it only seems to happen is you suspend the computer.

A humble theory: Does EasyCode read the background color from some Windows variable/structure that may change after suspending ??

Best regards.
Title: Re: The color changing bug.
Post by: rsala on February 21, 2015, 08:08:58 AM
Hi again,

Actually, the only thing I can think of is that Easy Code processes de WM_SYSCOLORCHANGE message, which is only sent by Windows when a system color changes. The point is I do not know whether the windows background system color changes when Windows is suspended. I will try to find it out.

Regards,

Ramon
Title: Re: The color changing bug.
Post by: rsala on February 21, 2015, 08:26:46 AM
Hi AssemblyChallenge,

Would you please do me a favor?

I attach a slightly modified version of EC. It will show a message box if the WM_SYSCOLORCHANGE has been sent to Easy Code, so that I can know if it is the responsible of the "whiteness".

Please replace your EasyCode.exe file, in the \EasyCode.Ms\Bin folder with the one attached to this post.

Thanks for your help,

Ramon
Title: Re: The color changing bug.
Post by: AssemblyChallenge on February 24, 2015, 12:21:07 AM
Hi,

Testing in progress, will let you know ASAP.  :biggrin:

Regards.
Title: Re: The color changing bug.
Post by: rsala on February 25, 2015, 05:29:28 AM
Thank you very much!
Title: Re: The color changing bug.
Post by: AssemblyChallenge on February 28, 2015, 06:12:04 AM
So far, not so good  :(

For several days with no luck. Still waiting for changes or messages.

Still trying, Master.
Title: Re: The color changing bug.
Post by: rsala on March 01, 2015, 08:58:23 PM
Thanks for your help  :t
Title: Re: The color changing bug.
Post by: AssemblyChallenge on March 10, 2015, 01:41:05 AM
Finally! After so many days trying the new exe I got some movement  :lol:

Loaded two different projects and both failed (color changed) without messages or errors.

Attached images from both.
Title: Re: The color changing bug.
Post by: rsala on March 12, 2015, 09:10:47 AM
Thank you very much! I really appreciate your help!

However, I have no idea why color changes but I will try to find it out.

Regards,

Ramon
Title: Re: The color changing bug.
Post by: AssemblyChallenge on March 13, 2015, 02:04:25 AM
Ok.

The projects with the new exe were open (and failed) at the same time, just in case it may be useful to know about it.

More humble ideas: The editor part (Edit control, right?) is mounted on MDI window. Is there any chance this could be related? How about WMPaint or something AFTER resuming from standby? Is it only the Edit's background color who is changing and, so far, never on runtime.
Title: Re: The color changing bug.
Post by: AssemblyChallenge on March 13, 2015, 03:23:58 AM
Even more ideas!

Please take a look at this  this (http://stackoverflow.com/questions/17941527/changing-the-background-of-an-edit-control-on-getting-focus). It doesnt looks like our case but, who knows  :lol:

Whatever, as long as it gives you some light/inspiration  ;)
Title: Re: The color changing bug.
Post by: AssemblyChallenge on March 18, 2015, 06:50:12 AM
Feedback continues:

* Took note from background colors before and after the bug.
* In Preferences, Editor, there is no change (it's default, Background, System colors). Even after bug, Preferences are fine.
* With affected EasyCode still open, opened new instance: It does with normal colors.

What else:

* Just in case will keep bugged EasyCode opened (as it is hard to replicate problem). If you need any info let me know (ej. attach Ollydbg, look into memory, etc) :bgrin:
* Will make a simple experiment with very small project checking background colors. Who knows, maybe it's Windows Policies the problem's source.

Regards, Master.
Title: Re: The color changing bug.
Post by: rsala on March 21, 2015, 05:27:02 AM
Hi AssemblyChallenge,

Once again thank you very much! I really appreciate your useful help.

I will study all this informatio to see whether I can find the problem.

Regards,

Ramon
Title: Re: The color changing bug.
Post by: rsala on March 21, 2015, 05:32:47 AM
By the way, the editor part is not an Edit control, it's a complete editor programmed by me. Actually it is an Easy Code module because the EC IDE is just a visual project, that is, Easy Code is a visual project built by itself.
Title: Re: The color changing bug.
Post by: AssemblyChallenge on March 21, 2015, 06:30:07 AM
Roger that.

What I mean is: the "native" Windows component where you write the text.

My wild guessing was: EC is a Main window with MDI childs (Editor, Designer, etc) and inside that Editor child, maybe some enlarged Edit Control :lol: where you actually type the code.

The idea is to understand how is made so I can help you searching for a similar problem in someone else's project.  :bgrin:
Title: Re: The color changing bug.
Post by: rsala on March 24, 2015, 09:22:14 AM
Hi,

I am sorry if I misunderstanding you.

The Easy Code Editor is a Windows window, of course, but anything else, no Windows controls. I paint the background and the text according to the settings for the colors and font, so if the background color is not changed I do not understand why you get a white background.

I will try to redraw the background when the editor gets the focus, maybe it will solve the problem.

Regards  :t
Title: Re: The color changing bug.
Post by: AssemblyChallenge on March 25, 2015, 03:41:43 AM
A color changed EC is still opened. If I attach Ollydbg to it, is there any chance we can get some useful info (address, structure, whatever) ?
Title: Re: The color changing bug.
Post by: rsala on March 25, 2015, 11:20:33 AM
Well I am not sure, but I am affraid it will be difficult.

I will send you the sources of the editor module.
Title: Re: The color changing bug.
Post by: AssemblyChallenge on April 08, 2015, 12:48:29 AM
A mini-update:

* Last week finished a small program. For the very first time and out of the blue, the color changed while editing the project, doing normal stuff. I'm guessing this piece of info could help you.

* Still reading the code you sent (by the way, thank you , I still feel humble about it).
Title: Re: The color changing bug.
Post by: rsala on April 12, 2015, 04:41:08 PM
Sorry for the delay, I've been outside for a pair of days.

Thanks for your help once again.

I am really sorry but I am not able to fire the color change problem.

Title: Re: The color changing bug.
Post by: rsala on August 07, 2015, 06:46:38 AM
Hi AssemblyChallenge,

I think I could solve the color changing bug. Please try the attached executable.

Replace your EasyCode.exe file, in the \EasyCode.Ms\Bin folder with the one attached to this post.

Thanks for your help,

Ramon
Title: Re: The color changing bug.
Post by: AssemblyChallenge on August 08, 2015, 01:06:12 PM
Hi,

Downloaded and testing in progress. Will let you know  :t
Title: Re: The color changing bug.
Post by: rsala on August 08, 2015, 04:47:25 PM
Great!

Thanks.
Title: Re: The color changing bug.
Post by: AssemblyChallenge on August 14, 2015, 12:48:10 AM
Well, so far so good  :bgrin:

Or at least for now. Generally it changed after several hours or from one day to another.
Still missing the suspend part; that one will be today in the afternoon.

Any info about the possible cause ?? This is, by far, my favourite bug in EC  :lol:
Title: Re: The color changing bug.
Post by: rsala on August 14, 2015, 05:00:38 PM
Hi,

Well, in fact I do not know why it happens. What I did is processing the WM_POWERBROADCAST message. When Windows "wakes up" and the POWERBROADCAST message is received, the editor is redrawn.

It seems to work!
Title: Re: The color changing bug.
Post by: AssemblyChallenge on August 18, 2015, 10:05:05 PM
Damn, version 0.8 not fixed yet  :(

It didn't survive the suspend test (for several days). On the bright side, now we get the worst from both worlds  :lol: :lol: so take a look at the attachment for a mix of a color changed - line number damaged beast  :lol:

Greetings.
Title: Re: The color changing bug.
Post by: rsala on August 18, 2015, 10:30:31 PM
Thanks once again for your help!

Damn, each time it's worse. It seems I'll have to work hard to find out the problem.

I'll be in touch.

Ramon
Title: Re: The color changing bug.
Post by: AssemblyChallenge on August 19, 2015, 07:20:40 AM
Hum, very interesting.

I was checking the other bug with INI files and got this... hunch. In the sense that maybe, just maybe could be related with Windows's internal color constants. Please, take a look at the attached PDF; as a programmer you surely know must part of that stuff. Still, I see my background color (black) set as 0x80000001 (which is also Desktop Color) in EC.

Not sure if this helps but, who knows, give it a try  :bgrin:
Title: Re: The color changing bug.
Post by: rsala on August 19, 2015, 07:44:22 AM
Yes, 0x80000001 is the Desktop color in Windows, and yes I will read the pdf file you attached.

Thanks,

Ramon


Title: Re: The color changing bug.
Post by: AssemblyChallenge on August 21, 2015, 07:11:29 AM
Hi.

EC 0.9 just color failed on me today, so, a quick recap:

* Only text background changes.
* Color settings in options do not change (or gets modified) after the bug.
* You don't have to suspend the computer, just leave EC open for long periods of time.
* It can change out of the blue while you work on it.
* If you open several instances of EC, they all get color changed  :dazzled:

Greetings, Master.
Title: Re: The color changing bug.
Post by: rsala on August 21, 2015, 07:32:25 AM
Well, thanks for the report. I will try to find the bug.
Title: Re: The color changing bug.
Post by: AssemblyChallenge on August 25, 2015, 03:44:11 AM
Wait!

As soon as I clicked the "Send" button and opened EC, was greeted by a pink background.
Do you know what that means ??? BINGOOOOO  :greenclp: :greenclp:

Take a look at the attachments please.

Steps to reproduce (I use Win7 Pro SP1 x64):

- Set background color in EC settings (attach-2)
- Set background color in Windows options. (attach-1)
- Enjoy the bug  :lol: (attach-3)

So my previous idea about system colors were not so far from reality, right ?  :shock:

That means EC should set the background color as "reference" from Windows but maybe not set the system color itself because then EC will be changing its colors at the same time as Windows. This is, of course, if you want to keep them separate. Maybe some other EC colors based on system could be affected too. Also, maybe is my background who changes with corporate Policies.

Regards.

PD: Finally, that pink color can make you go blind in seconds  :lol:
Title: Re: The color changing bug.
Post by: AssemblyChallenge on August 25, 2015, 06:48:04 AM
Meh, maybe I got excited too soon  :icon_redface:

I touched nothing and left EC open, just to see how it would look like. It changed, of course, but I still have the ugly theme and eye burning pink as Windows background color. EC also shows the pink as background. The change, as usual, is white.

Anyway, I still feel we are getting close to the cause. My next experiment will be using a background color not defined by system.

Regards
 
Title: Re: The color changing bug.
Post by: rsala on August 25, 2015, 07:44:48 AM
Yes, that is exactly what I meant. To set a solid color for editor background (not the desktop).

Thanks for your help (and your patience)!
;)
Title: Re: The color changing bug.
Post by: AssemblyChallenge on August 27, 2015, 12:53:22 AM
Well, as before: So far so good.

Defined an ugly blue color for background and no change. Created a black color too and no signs of the bug  :bgrin:

Today in the afternoon will come the suspending part. There is strong evidence now to assume this problem discovered if everything goes fine. All of that in a hurry as my main PC will be migrated to Windows 10 Pro x64 in the coming days.

Regards.
Title: Re: The color changing bug.
Post by: rsala on August 27, 2015, 04:46:15 AM
Good news! However I still do not know why it fails with the Desktop system color. It shoud not.

There is no need to choose an ugly color, you could choose the same color that the Desktop but as a "solid color", not as the system desktop color (0x80000001).

:icon14:


Title: Re: The color changing bug.
Post by: AssemblyChallenge on August 28, 2015, 11:22:49 PM
Ok. After two days in a row with no errors including the dreaded suspend, I think we have enough evidence:

Avoid at all cost picking a color from System Colors's dialog box for your text background and instead define your own from the palette.

In any case, if you can't find the reason for this behavior, just keep it in mind for EC v2 (ie. do not show that dialog for picking colors, create your own or something) and put the footnote on the last oficial 1.X as this weird problem seems -so far- confined to my system.

The good news, as I said before, is that my computer will be Windows 10 soon and you can expect regular feedback from me  :t :t
Title: Re: The color changing bug.
Post by: rsala on August 29, 2015, 03:41:51 AM
Hi AssemblyChallenge,

Well, these are (relatively) good news. I still do not understand why your text background changes. I will try to find the reason but it will not be easy if it does not happen to me.

Thank you very much for your help!

Best regards.
Title: Re: The color changing bug.
Post by: rsala on August 30, 2015, 11:01:41 PM
Hi again,

I don't want to be a real pain :icon_redface:, but I'm trying to find the bug.

Would you please test the attached executable (EasyCode.Ms) choosing the system desktop color as the text background? Thanks.

If for any reason a system color is changed, this new exe will display a dialog box. Besides, it re-reads the text background every time the editor needs to be repainted.

Thanks in advance!
Title: Re: The color changing bug.
Post by: AssemblyChallenge on August 31, 2015, 11:10:21 AM
Consider it done, Master  :bgrin:
Title: Re: The color changing bug.
Post by: rsala on August 31, 2015, 09:05:59 PM
Once again, thank you very much indeed!
:t
Title: Re: The color changing bug.
Post by: AssemblyChallenge on September 08, 2015, 07:22:29 AM
Hi.

Guess what: Not a single error in all this days  :dazzled:

I even made a copy -and reopened- the old EC just to be sure and zero, nada.

:shock:

Title: Re: The color changing bug.
Post by: rsala on September 09, 2015, 07:22:16 AM
I don't understand anything (:shock:), but thanks again for your patience!

I will release a new version of EC v1 one of these days (probably the last one).

:t
Title: Re: The color changing bug.
Post by: AssemblyChallenge on September 10, 2015, 10:34:26 AM
Ok then.

The reason I uploaded the PDF file was that, a couple of years ago, I had a case somehow resembling our problem, with a twist.

A legacy app programmed with VB6. They forced a color in several form's components and as result, if you changed Windows theme, then those components remained black -and obviously unreadable for the final users-. The solution for them was changing the form's colors with those from system so when you change Windows's colors, app colors changed too (ie, the same way that Calc, etc, does).

Since I found this weird bug, just can't stop thinking about that case but I'm not sure how to correlate it into EC.

:bgrin: :t
Title: Re: The color changing bug.
Post by: rsala on September 12, 2015, 11:41:43 PM
Well, thanks for the information anyway!
:t