Click here to Skip to main content
15,891,529 members
Home / Discussions / C#
   

C#

 
GeneralRe: WinForms - Detect End of RichTextBox Pin
V.25-Nov-11 3:23
professionalV.25-Nov-11 3:23 
AnswerRe: WinForms - Detect End of RichTextBox Pin
BobJanova16-Nov-11 6:07
BobJanova16-Nov-11 6:07 
GeneralRe: WinForms - Detect End of RichTextBox Pin
Matt U.16-Nov-11 8:20
Matt U.16-Nov-11 8:20 
GeneralRe: WinForms - Detect End of RichTextBox Pin
Pete O'Hanlon16-Nov-11 8:45
mvePete O'Hanlon16-Nov-11 8:45 
GeneralRe: WinForms - Detect End of RichTextBox Pin
Matt U.16-Nov-11 8:50
Matt U.16-Nov-11 8:50 
GeneralRe: WinForms - Detect End of RichTextBox Pin
BobJanova16-Nov-11 23:16
BobJanova16-Nov-11 23:16 
AnswerRe: WinForms - Detect End of RichTextBox Pin
BillWoodruff16-Nov-11 14:41
professionalBillWoodruff16-Nov-11 14:41 
QuestionBug in ShowWindow in Windows 7 Pin
Axonn Echysttas16-Nov-11 2:08
Axonn Echysttas16-Nov-11 2:08 
Hello everybody. For *two weeks*, each day since I installed Windows 7, I have been struggling to get something to work. Something which worked perfectly ok in XP. It's driving me mad, poisoning my life, ruining my days. Why such a simple task works SO CHAOTICALLY!?

I think I discovered a bug in Windows 7, specifically in the way the ShowWindow function works in the standard theme (Aero).

To demonstrate this, I uploaded 2 C# WinForms applications and their source code.

http://www.axonnsd.org/W/P007/BugsDemo.rar

HideableApplication represents an application which you can hide in the SysTray when you close it. Double clicking the SysTray icon reveals it and right clicking will reveal the "Exit" option.

HideableApplicationRevealer attempts to show HideableApplication's window.

The reason I need to accomplish this task is because I minimize my Total Commander and FireFox to the Tray and I want to bring them back via a HotKey. Total Commander offers such a functionality but it is broken.

On Windows XP I managed to accomplish both these tasks without any problems, using the code I attached.

On Windows 7, the behavior is erratic at best, and non-functional at worst.

When HideableApplication runs inside Visual Studio everything works:
- Trying to reveal it via HideableApplicationRevealer from Visual Studio => SUCCESS
- Trying to reveal it via manual execution of HidebleApplicationRevealer.exe from Debug folder => SUCCESS
- Trying to reveal it via running HideableApplicationRevealer.exe via keyboard shortcut => SUCCESS
- Trying to reveal it via running HIdeableApplicationRevealer.exe via a Scheduled Task with Admin Rights => SUCCESS.

When HideableApplication was executed manually (via .exe from Debug folder) AND Visual Studio IS STARTED, it works if I use admin rights or run it manually:
- Trying to reveal it via HideableApplicationRevealer from Visual Studio => FAIL
- Trying to reveal it via manual execution of HidebleApplicationRevealer.exe from Debug folder => SUCCESS
- Trying to reveal it via running HideableApplicationRevealer.exe via keyboard shortcut => FAIL
- Trying to reveal it via running HIdeableApplicationRevealer.exe via a Scheduled Task with Admin Rights => SUCCESS.
- Trying to reveal it via running HideableApplicationRevealer.exe via keyboard shortcut (start menu) which has been given ADMIN RIGHTS => SUCCESS.

When HideableApplication was executed manually (via .exe from Debug folder) AND Visual Studio HAS BEEN SHUT DOWN: it only works if I run it manually (double click exe):
- Trying to reveal it via manual execution of HidebleApplicationRevealer.exe from Debug folder => SUCCESS
- Trying to reveal it via running HideableApplicationRevealer.exe via keyboard shortcut => FAIL
- Trying to reveal it via running HIdeableApplicationRevealer.exe via a Scheduled Task with Admin Rights => PROBLEMS: Window blinks on the TaskBar instead of being shown!
- Trying to reveal it via running HideableApplicationRevealer.exe via keyboard shortcut (start menu) which has been given ADMIN RIGHTS => SUCCESS.

If it matters, I reproduced this behavior both with the Taskbar in its standard position AND also with it set to AutoHide, in the left of the screen.

Apparently, I need admin rights to show a window, but even like this, it doesn't work right when I use the Scheduled Task workaround (create Scheduled Task with admin rights and invoke the Scheduled Task via system32/schtasks.exe /run /tn "task name"). What happens is that AFTER VISUAL STUDIO IS SHUT DOWN, the window blinks on the TaskBar instead of being shown (and has no focus). It does appear, but it has no keyboard focus, which should NOT happen because I also used the SetForegroundWindow API.

This is exactly what happens when I try to run reveal Total Commander as well: read below, same behavior: blinks on taskbar instead of being shown.

And don't even get me started on the difference in behaviors between when running it from Visual Studio and when running it from its usual C:\MyProjects folder.

My TotalCommanderRevealer and FireFoxRevealer exhibit even stranger behaviors: when starting Visual Studio, the Total Commander app stops working properly. Even if I load NO PROJECT, instead of showing TC to me, it just blinks it on the TaskBar. However if I open the TCRevealer project, it starts working again! If I shut down Visual Studio, it STOPS working UNTIL I RESTART WINDOWS.

The FireFoxRevealer instead of revealing FireFox, does something very strange: it shows a small label in the top-left corner of the screen, usually with something related to the opened tab. I suspect this has to do with the Window Style and the way the ShowWindow function works in Windows 7. However, sometimes it works, showing the actual window. But most of the time it doesn't. And when it stops working, I never get it to work again until certain unknown circumstances occur and it works again. Regardless, this worked pefectly under Windows XP and does not work at all now.

If you wish to reproduce the FireFox issue, use the code I attached: instead of searching for "Hideable Application" text in FindWindow API, search for "MozillaWindowClass", install FireFox 7 or 8 and install the FireFox "Minimize To Tray Revived" addon.

I should also mention that I'm aware of the "ForegroundLockTimeout" registry setting and I have set it to 0 everywhere it appears in the Registry. On Windows XP it is set by default to 0 but in Windows 7 the default value was 200000, which I have changed. Maybe somehow it lingers somewhere??? And Visual Studio, while running, sets it to 200000 when I shut it down, until I restart the computer? I looked in the Registry and it doesn't change, it's still 0. But who knows?
I thank you for helping me... by contributing!

Axonn @ SourceForge ^

Questionproblem: popup image onclick gridview image using model popup and web service Pin
Rohit Sharma70616-Nov-11 1:38
Rohit Sharma70616-Nov-11 1:38 
QuestionUpdating the password handling Pin
Bernhard Hiller15-Nov-11 20:32
Bernhard Hiller15-Nov-11 20:32 
AnswerRe: Updating the password handling PinPopular
Peter_in_278015-Nov-11 20:45
professionalPeter_in_278015-Nov-11 20:45 
GeneralRe: Updating the password handling Pin
OriginalGriff16-Nov-11 0:13
mveOriginalGriff16-Nov-11 0:13 
GeneralRe: Updating the password handling Pin
Reiss16-Nov-11 2:57
professionalReiss16-Nov-11 2:57 
GeneralRe: Updating the password handling Pin
Peter_in_278016-Nov-11 9:53
professionalPeter_in_278016-Nov-11 9:53 
GeneralRe: Updating the password handling Pin
Bernhard Hiller16-Nov-11 21:45
Bernhard Hiller16-Nov-11 21:45 
AnswerRe: Updating the password handling Pin
BobJanova16-Nov-11 3:04
BobJanova16-Nov-11 3:04 
AnswerRe: Updating the password handling Pin
Luc Pattyn16-Nov-11 4:03
sitebuilderLuc Pattyn16-Nov-11 4:03 
GeneralRe: Updating the password handling Pin
Peter_in_278016-Nov-11 10:02
professionalPeter_in_278016-Nov-11 10:02 
GeneralRe: Updating the password handling Pin
Bernhard Hiller16-Nov-11 23:02
Bernhard Hiller16-Nov-11 23:02 
QuestionReading next block of data on button click event Pin
MumbleB15-Nov-11 18:55
MumbleB15-Nov-11 18:55 
AnswerRe: Reading next block of data on button click event Pin
RobCroll15-Nov-11 19:40
RobCroll15-Nov-11 19:40 
AnswerRe: Reading next block of data on button click event Pin
Wayne Gaylard15-Nov-11 19:42
professionalWayne Gaylard15-Nov-11 19:42 
AnswerRe: Reading next block of data on button click event Pin
BobJanova16-Nov-11 3:09
BobJanova16-Nov-11 3:09 
QuestionTimers & editing controls Pin
Krylosac15-Nov-11 16:35
Krylosac15-Nov-11 16:35 
AnswerRe: Timers & editing controls Pin
Wayne Gaylard15-Nov-11 17:06
professionalWayne Gaylard15-Nov-11 17:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.