Skip to content
This repository has been archived by the owner on Jun 20, 2021. It is now read-only.

ThunderBirdTray cannot find the main window when used with a Chinese version of Thunderbird #19

Closed
cailei77 opened this issue Apr 22, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@cailei77
Copy link

I use the ThunderbirdTray with a Chinese version of Thunderbird, but it doesn't work all the times. I found that it did not work when the title of the main window of Thunderbird contained Chinese characters while it worked well when the title consisted of pure ASCII chars. After debugging the source, the problem was found on the capacity of windowTextBuilder in the lambda expression in the call of the EnumWindows function. I guess that StringBuilder counts the capacity by 1-byte char so that a chinese character is counted as 2 while GetWindowTextLength treats it as 1 character. So windowTextBuilder with capacity of length + 1 is always not long enough to save the title containing Chinese characters. The new program I compiled myself with length + 5 instead works well now.

@cailei77 cailei77 changed the title ThunderBirdTray cannot find the main window of Thunderbird when used with a Chinese version of Thunderbird ThunderBirdTray cannot find the main window when used with a Chinese version of Thunderbird Apr 22, 2020
@TheGuardianWolf
Copy link
Owner

TheGuardianWolf commented Apr 24, 2020

First of all, thanks for doing most of the debugging for me, that really saves me a lot of time investigating the cause of the issue.

For the sake of correctness, do you know the length required as a formula? Does +5 always work? I can put this bugfix together with the next update.

Alternatively I could just switch everything over to unicode, which might solve this issue. There is another bug I am afraid of but I'll deal with it if it does happen.

@TheGuardianWolf TheGuardianWolf added the bug Something isn't working label Apr 24, 2020
@TheGuardianWolf
Copy link
Owner

I released 1.5.0 with the change, could you test that out?

@TheGuardianWolf
Copy link
Owner

I briefly switched to Chinese (Simplified) locale and it seems to be functional, I'll close this for now. Please re-open if needed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants