Click here to Skip to main content
16,012,759 members
Home / Discussions / C#
   

C#

 
AnswerRe: .NET Remoting : 1 Client -> X Server Pin
joemonvarghese80@yahoo.co.in18-Jun-08 2:14
joemonvarghese80@yahoo.co.in18-Jun-08 2:14 
QuestionWhy Won't My MainForm Focus/Activate? Pin
Rafferty Uy18-Jun-08 0:30
Rafferty Uy18-Jun-08 0:30 
AnswerRe: Why Won't My MainForm Focus/Activate? Pin
Simon P Stevens18-Jun-08 0:47
Simon P Stevens18-Jun-08 0:47 
AnswerRe: Why Won't My MainForm Focus/Activate? Pin
ajtunbridge18-Jun-08 3:43
ajtunbridge18-Jun-08 3:43 
AnswerRe: Why Won't My MainForm Focus/Activate? Pin
Karthik Kalyanasundaram18-Jun-08 4:21
Karthik Kalyanasundaram18-Jun-08 4:21 
AnswerRe: Why Won't My MainForm Focus/Activate? Pin
Rafferty Uy18-Jun-08 15:21
Rafferty Uy18-Jun-08 15:21 
GeneralRe: Why Won't My MainForm Focus/Activate? Pin
Rafferty Uy18-Jun-08 15:45
Rafferty Uy18-Jun-08 15:45 
GeneralRe: Why Won't My MainForm Focus/Activate? [modified] Pin
Simon P Stevens18-Jun-08 22:16
Simon P Stevens18-Jun-08 22:16 
There doesn't seem to be anything unusual in your code. There are some odd bits in that splasher article though.

1) In the close method the code just totally swallows up all exceptions. This is very bad. something maybe going wrong and you won't know about it. Put some code in here to do something. (At the very very least, write to a log file so you know something went wrong. Ideally, Display an error message and shutdown the application)

2) The article uses Application.Run to start a new message pump from inside a separate thread. Seems a bit weird, not sure what impact this will have. .ShowDialog may have been a better way of doing it. This creates a nested message pump. (Maybe there is no difference, I'm not sure about this)

3) It uses reflection to manage the splash screen. Again, bit weird, he knows it's a form, why not just use a form object. Don't think this has any real problems though, it's just a bit of an odd way of doing things.

Let me try the Splasher stuff out and I'll get back to you in a bit.

[Edit: Yes, I get exactly the same issue with that splasher article code...Hang on...]

[Edit 2: Think you just need to abandon this article's method. The problem is something to do with having two message pumps running. When the first closes, the focus returns to the explorer window, even if you ensure the main form is fully loaded and displayed before letting the first message pump stop. I played around with it a bit, but it always causes exactly the same issue.

The reason that all those active/bring to front methods don't work is because they all rely on an api call that was changed with windows XP. It was decided that applications should not be allowed to steal focus because it annoys the user if they are working on something else.

I would suggest reading this[^] article. It describes a technique of using a ApplicationContext object to load two forms. Ignore all the stuff in there about reading/writing the window state to disk. Just use the appcontext to show your splash screen, do your initialising, show your main form and close your splash screen.]

Simon

modified on Thursday, June 19, 2008 4:56 AM

GeneralRe: Why Won't My MainForm Focus/Activate? Pin
Rafferty Uy19-Jun-08 0:52
Rafferty Uy19-Jun-08 0:52 
GeneralRe: Why Won't My MainForm Focus/Activate? Pin
Simon P Stevens19-Jun-08 1:47
Simon P Stevens19-Jun-08 1:47 
QuestionAppDomain for unloading an assembly Pin
elektrowolf18-Jun-08 0:21
elektrowolf18-Jun-08 0:21 
AnswerRe: AppDomain for unloading an assembly Pin
Simon P Stevens18-Jun-08 0:29
Simon P Stevens18-Jun-08 0:29 
GeneralRe: AppDomain for unloading an assembly Pin
elektrowolf18-Jun-08 0:31
elektrowolf18-Jun-08 0:31 
GeneralRe: AppDomain for unloading an assembly Pin
Simon P Stevens18-Jun-08 0:38
Simon P Stevens18-Jun-08 0:38 
GeneralRe: AppDomain for unloading an assembly Pin
Simon P Stevens18-Jun-08 0:43
Simon P Stevens18-Jun-08 0:43 
GeneralRe: AppDomain for unloading an assembly Pin
elektrowolf18-Jun-08 2:04
elektrowolf18-Jun-08 2:04 
QuestionGeneric type should accept only delegate types Pin
N a v a n e e t h17-Jun-08 23:39
N a v a n e e t h17-Jun-08 23:39 
AnswerRe: Generic type should accept only delegate types Pin
Pete O'Hanlon18-Jun-08 0:13
mvePete O'Hanlon18-Jun-08 0:13 
GeneralRe: Generic type should accept only delegate types Pin
N a v a n e e t h18-Jun-08 0:43
N a v a n e e t h18-Jun-08 0:43 
AnswerRe: Generic type should accept only delegate types Pin
led mike18-Jun-08 5:18
led mike18-Jun-08 5:18 
GeneralRe: Generic type should accept only delegate types Pin
N a v a n e e t h18-Jun-08 6:43
N a v a n e e t h18-Jun-08 6:43 
QuestionIFormatProvider.GetFormat Pin
George_George17-Jun-08 23:08
George_George17-Jun-08 23:08 
AnswerRe: IFormatProvider.GetFormat Pin
Simon P Stevens17-Jun-08 23:19
Simon P Stevens17-Jun-08 23:19 
GeneralRe: IFormatProvider.GetFormat Pin
George_George17-Jun-08 23:52
George_George17-Jun-08 23:52 
GeneralRe: IFormatProvider.GetFormat Pin
Simon P Stevens18-Jun-08 0:18
Simon P Stevens18-Jun-08 0:18 

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.